akhauriyash/Code-Regression huggingface dataset:
#![allow(unused_imports, unused_variables, dead_code)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

trait InputValue {
    fn parse(s: &str) -> Self;
}

fn read<T: InputValue>() -> T {
    let mut buf = String::new();
    let _ = stdin().read_line(&mut buf);
    T::parse(&buf.trim())
}

fn readnc<T: InputValue>() -> Vec<T> {
    let mut vec = vec![];
    let line: String = read();
    for token in line.split_whitespace() {
        vec.push(T::parse(token));
    }
    vec
}

fn readn<T: InputValue>(n: usize) -> Vec<T> {
    let mut vec = vec![];
    for _ in 0..n {
        vec.push(read());
    }
    vec
}

macro_rules! parse_single_value {
    ($($t:ty),*) => {
        $(
            impl InputValue for $t {
                fn parse(s: &str) -> $t { s.parse().unwrap() }
            }
        )*
	}
}
parse_single_value!(i32, i64, f32, f64, usize, String);

macro_rules! parse_tuple {
	($($t:ident),*) => {
		impl<$($t),*> InputValue for ($($t),*) where $($t: InputValue),* {
			fn parse(s: &str) -> ($($t),*) {
				let mut tokens = s.split_whitespace();
				let t = ($($t::parse(tokens.next().unwrap())),*);
				t
			}
		}
	}
}
parse_tuple!(A, B);
parse_tuple!(A, B, C);

// ===

fn main() {
    let n: usize = read();
    let edges: Vec<(usize, usize)> = readn(n-1);

    let mut graph: Vec<Vec<usize>> = vec![vec![]; n];
    for i in 0..n-1 {
        let a = edges[i].0-1;
        let b = edges[i].1-1;
        graph[a].push(b);
        graph[b].push(a);
    }

    let mut par: Vec<usize> = vec![0; n];
    let mut depth: Vec<usize> = vec![0; n];
    let mut count: Vec<usize> = vec![0; n];
    dfs(0, 0, n, &graph, &mut par, &mut depth, &mut count);

    let cnt = depth[n-1] + 1;
    let mut head = n-1;
    for i in 0..(cnt/2-1) {
        head = par[head];
    }
    let fennec = n - count[head];
    let snuke = count[head];
    if fennec > snuke {
        println!("Fennec");
    } else {
        println!("Snuke");
    }
}

fn dfs(now: usize, dep: usize, par: usize, graph: &Vec<Vec<usize>>, parent: &mut Vec<usize>, depth: &mut Vec<usize>, count: &mut Vec<usize>) {
    parent[now] = par;
    depth[now] = dep;
    count[now] = 1;
    for &to in &graph[now] {
        if to == par {
            continue;
        }
        dfs(to, dep+1, now, graph, parent, depth, count);
        count[now] += count[to];
    }
}


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

int main() {
	string input;
	getline(cin, input);
	for (int i = 0; i < input.length(); i++) {
		if (input[i] == 'p') {
			if (input[i+1]=='e'&&input[i+2]=='a'&&input[i+3]=='c'&&input[i+4]=='h') {
				input[i]='a'; input[i+1]='p'; input[i+2]='p';
				input[i+3]='l'; input[i+4]='e';
				i += 4;
			}
		} else if (input[i] == 'a') {
			if (input[i+1]=='p'&&input[i+2]=='p'&&input[i+3]=='l'&&input[i+4]=='e') {
				input[i]='p'; input[i+1]='e'; input[i+2]='a';
				input[i+3]='c'; input[i+4]='h';
				i += 4;
			}
		}
	}
	cout << input << endl;
}

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    vector<int> digits(n + 1, -1);
    for (int i = 1; i <= m; ++i) {
        int s, c;
        cin >> s >> c;
        if (digits[s] == -1) {
            digits[s] = c;
        } else if (digits[s] != c) {
            cout << "-1\n";
            return 0;
        }
    }
    for (int i = 1; i <= n; ++i) {
        if (digits[i] == -1) {
            if (n != 1) {
                digits[i] = 1;
            } else {
                digits[i] = 0;
            }
        }
        while (i <= n) {
            if (digits[i] == -1) {
                digits[i] = 0;
            }
            ++i;
        }
    }
    bool all_zero = true;
    for (int i = 1; i <= n; ++i) {
        all_zero = all_zero && (digits[i] == 0);
    }
    if (all_zero && n > 1) {
        cout << "-1\n";
        return 0;
    }
    for (int i = 1; i <= n; ++i) {
        cout << digits[i];
    }
    cout << "\n";
    return 0;
}



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

def main():
    N = int(input())
    if N == 0:
        print(0)
        exit()

    ans = [0] * 100

    ruiseki = [1, -2]
    for i in range(2, 100):
        if i & 1:
            ruiseki.append(-2 ** i + ruiseki[i - 2])
        else:
            ruiseki.append(2 ** i + ruiseki[i - 2])

    while N != 0:
        for i in range(100):
            if N < 0 and i & 1 and ruiseki[i] <= N:
                N -= -2 ** i
                ans[i] = 1
                break
            elif N > 0 and not i & 1 and ruiseki[i] >= N:
                N -= 2 ** i
                ans[i] = 1
                break


    ans2 = []
    for i in range(99, -1, -1):
         if ans[i] == 1 or len(ans2) > 0:
             ans2.append(ans[i])

    print("".join(map(str, ans2)))

if __name__ == '__main__':
    main()




Measured memory_bytes: 3064
import math

def convert(nn):
    return math.floor(((nn*8+1)**0.5-1)/2)

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

n=int(input())
if n==1:
    print(0)
else:
    result=factorization(n)
    answer=0
    for i in range(len(result)):
        answer+=convert(result[i][1])
    print(answer)

Measured memory_bytes: 63580
#include<stdio.h>

int main(){
  long long n,ans=1;
  scanf("%lld",&n);
  long long a[n+1],b=1000000000000000000;
  for(long long i=1;i<=n;i++){scanf("%lld",&a[i]);}
  
  for(int i=1;i<=n;i++){
    if(a[i]==0){printf("0");return 0;}
  }
  
  for(long long i=1;i<=n;i++){
    if(b/ans<a[i]){printf("-1");return 0;}
    
    ans*=a[i];
  }
  
  printf("%lld",ans);
}

Measured memory_bytes: 2504
N, K = map(int, input().split())
S = 'R' + input() + 'L'
UH = [0] * (N + 1)
d = 'R'
for i, s in enumerate(S):
  if s == 'R':
    if S[i + 1] == 'L':
      UH[i] += 1
  else:
    if S[i - 1] == 'R':
      UH[i - 1] += 1
UH[0] = min(UH[0], 1)
UH[N] = min(UH[N], 1)
UH.sort(reverse=True)
for i in range(min(K, N + 1)):
  UH[i] = 0
if sum(UH) == 0:
  UH[0] = 1
print(N - sum(UH))

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

int main() {
  ll X,K,D; cin>>X>>K>>D;
  ll ans;
  // 真ん中まで移動しきれないパターン
  if(abs(X)/D >= K) ans=abs(X)-K*D;
  else {
    // 最小になる場合の移動回数を求める
    ll move1 = abs(X) - (abs(X)/D)*D;;
    ll move2 = abs(move1-D);
    if(move1==move2) ans=move1;
    else {
      if(K%2 == (abs(X)/D)%2) ans=move1;
      else ans=move2;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3644
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;

int main() {
	int A, B, C, D;
	cin >> A >> B >> C >> D;
	int answer = min(B,D)-max(A,C);
	if(answer>0) cout << answer << endl;
	else cout << 0 << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;

//typedef
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//conversion
inline LL toLong(string s) {LL v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) LL((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define UNTIL(p) while(!(p))

//constant
const double EPS = 1e-5;
const double PI  = acos(-1.0);

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

#define PUTS(x) cout << (x) << endl;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    LL n,k;
    cin>>n>>k;
    double sum=0;
    REP(i,n){
        double p = 1;
        LL x = i + 1;
        while(x <= k - 1){
            x *= 2;
            p /= 2;
        }
        sum += p/n;
    }
    printf("%.14f", sum);
}

Measured memory_bytes: 256
/*RUSTAM1111 🦁🦁🦁💪💪💪😎😎😎🔥🔥🔥🔥⚔️⚔️⚔️*/
/*RUSTAM1111 🦁🦁🦁💪💪💪😎😎😎🔥🔥🔥🔥⚔️⚔️⚔️*/
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a, b;
	cin>>a>>b;
	if(a*500<b)
	{
		cout<<"No"<<endl;
	}
	else
	{
		cout<<"Yes"<<endl;
	}
}/*RUSTAM1111 🦁🦁🦁💪💪💪😎😎😎🔥🔥🔥🔥⚔️⚔️⚔️*/

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

int main() {

int a,b,c,x;
  
cin >> a >> b;
x = ((a + b) / 2);
c = ((a + b) % 2);
  
if (c == 0){
cout << x;
}else{
x = x + 1;
cout << x;
}

}

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

template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

int main() {
    int A, B, T;
    cin >> A >> B >> T;
    cout << (T/A)*B << endl;
    return 0;
}


Measured memory_bytes: 256
import itertools

ABCD = list(map(int, input()))

for ops in itertools.product('+-', '+-', '+-'):
    ans = ABCD[0]
    for i, op in enumerate(ops, 1):
        if op == '+':
            ans += ABCD[i]
        else:
            ans -= ABCD[i]

    if ans == 7:
        ss = str(ABCD[0])
        for i, op in enumerate(ops, 1):
            ss += op + str(ABCD[i])
        ss += '=7'
        print(ss)
        exit()


Measured memory_bytes: 3060
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
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

class LowLink:
    def __init__(self, v):
        self.size = len(v)
        self.v = v
        self.pre = [None]*self.size
        self.low = [None]*self.size
        self.articulation = []
        self.bridge = []
        for x in range(self.size):
            if self.pre[x] is None:
                self.cnt = 0
                self.dfs(x,None)

    def dfs(self, x, par):
        self.pre[x] = self.low[x] = self.cnt
        self.cnt += 1
        is_articulation = False
        n = 0
        for y in self.v[x]:
            if self.pre[y] is None:
                n += 1
                lowy = self.dfs(y, x)
                if lowy < self.low[x]:
                    self.low[x] = lowy
                if self.pre[x] <= lowy:
                    if self.pre[x]:
                        is_articulation = True
                    if self.pre[x] < lowy:
                        self.bridge.append((x,y))
            else:
                if par != y and self.pre[y] < self.low[x]:
                    self.low[x] = self.pre[y]

        if par is None and n > 1:
            is_articulation = True

        if is_articulation:
            self.articulation.append(x)

        return self.low[x]


def solve():
    n,m = LI()
    v = [[] for i in range(n)]
    for i in range(m):
        a,b = LI()
        v[a].append(b)
        v[b].append(a)
    lowlink = LowLink(v)
    for i in sorted(lowlink.articulation):
        print(i)
    return

#Solve
if __name__ == "__main__":
    solve()



Measured memory_bytes: 19752
H ,W = map(int, input().split())
matrix = []
for i in range(H):
    m = list(input())
    matrix.append(m)
flag = True
while(flag):
    flag = False
    for i in range(H):
        if matrix[i].count(".")==W:
            del matrix[i]
            H -= 1
            flag = True
            break
    for i in range(W):
        cnt = 0
        for j in range(H):
            if matrix[j][i]==".":
                cnt += 1
        if cnt==H:
            for k in range(H):
                del matrix[k][i]
            flag = True
            W -= 1
            break
for i in matrix:
    print("".join(i))

Measured memory_bytes: 3188
using System;

namespace abc053_b
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            int a = 0;
            int z = 0;
            bool b = true;
            for (int i = 0; b; i++)
            {
                if (s[i] == 'A')
                {
                    a = i;
                    b = false;
                }
            }
            b = true;
            for (int i = s.Length - 1; b; i--)
            {
                if (s[i] == 'Z')
                {
                    z = i;
                    b = false;
                }
            }
            Console.WriteLine(z - a + 1);
        }
    }
}

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

int main(){
    int A, B, T;
    cin >> A >> B >> T;

    int count = 0;

    for(int i = 1; i < T + 0.5; ++i) {
        if(i % A == 0) {
            count += B;
        }
    }

    cout << count << endl;
}

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

int main()
{
 int n;
 cin>>n;
 vector<int>vec;
 while(n>0)
 {
  vec.push_back(n%10);
  n = n/10;

 }
 int x=0;
 for(int i=0;i<vec.size();i++)
 {
  if(vec[i]==7)x=1;

 }
 if(x==1)cout<<"Yes"<<endl;
 else cout<<"No"<<endl;





}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a) for(int i=0; i<(int)(a); i++)
typedef long long ll;
const ll INF = 1LL<<60;

int main()
{
  int n,m; cin>>n>>m;
  vector<int> v(100010, 0);
  rep(i, m) {
    int a,b; cin>>a>>b;
    v[a]++; v[b]++;
  }
  rep(i, 100001) {
    if (v[i]%2) {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;

  return 0;
}


Measured memory_bytes: 768
n,m=map(int,input().split())
l=[]
for i in range(n):
    l.append(input())
dp=[[0 for i in range(m)]for i in range(n)]
for i in range(n):
    if l[i][0]=="#":
        break
    else:
        dp[i][0]=1
for j in range(m):
    if l[0][j]=="#":
        break
    else:
        dp[0][j]=1
        
for i in range(1,n):
    for j in range(1,m):
        if l[i][j]!="#":
            dp[i][j]=dp[i-1][j]+dp[i][j-1]
print(dp[-1][-1]%(10**9+7))

Measured memory_bytes: 209260
A,B,C=map(int,input().split())
K=int(input())
if (A>=B) and (A>=C):
    print(A*2**K+B+C)
elif (B>=C) and (B>=A):
    print(B*2**K+A+C)
else:
    print(C*2**K+B+A)


Measured memory_bytes: 2940
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;

int main()
{
	const double myPI = 3.14159265358979323846;
	double R;
	cin>>R;
	printf("%.9lf\n",2*myPI*R);
	return 0;
}



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

struct Card{
  char suit,value;
};


void bubble(struct Card A[],int N){
 
  for(int i=0;i<N;i++){
     for(int j=N-1;j>=i;j--){
       if(A[j].value<A[j-1].value){
          Card t = A[j];
         A[j] = A[j-1];
         A[j-1] =t;
       }
     }
  }
}



void sele(struct Card A[],int N){
 
  
   for(int i=0;i<N;i++){
     int minj=i;

     for(int j=i;j<N;j++){
       if(A[j].value<A[minj].value) minj=j;
     }
     Card t = A[i];
     A[i]=A[minj];
     A[minj]=t;
   }
}



void pri(struct Card A[],int N){

  
  for(int i=0;i<N;i++){
    if(i>0) cout << " ";
    cout << A[i].suit << A[i].value;
  }
  cout << endl;
}


bool isS(struct Card C1[],Card C2[],int N){
 
 for(int i=0;i<N;i++){
   if(C1[i].suit != C2[i].suit) return false;
 }
 return true;
}


int main(){
  Card C1[100],C2[100];
  int N;
 

  cin >> N;
  for(int i=0;i<N;i++){
    cin >> C1[i].suit >> C1[i].value;
  }

  for(int i=0;i<N;i++) C2[i]=C1[i];

  bubble(C1,N);
  sele(C2,N);

  pri(C1,N);

  cout << "Stable" <<endl;

  pri(C2,N);

  

  if(isS(C1,C2,N)){
    cout << "Stable" << endl;
  }
  else{
    cout << "Not stable" << endl;
  }

  return 0;
}



Measured memory_bytes: 3112
#include <iostream>
#include <math.h>
#include <algorithm>
#include <set>
#include <map>
#include <string>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)
#define rep_r(i,s,n)for(ll i=n-1;i>=s;i--)
#define repe_r(i,s,n)for(ll i=s;i<=n;i++)
static const ll MOD = 1e9 + 7;
static const ll MAX_L = (ll)1 << 55;

ll d[300][300] = {};
ll e[300][300] = {};
ll n;
void wf() {
	rep(k, 0, n)rep(i, 0, n)rep(j, 0, n) {
		//if (d[i][j] != MAX_L) {
		d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
		//}
	}
}
int main() {
	ll m; cin >> n >> m;
	rep(i, 0, n)rep(j, 0, n) {
		if (i == j) {
			d[i][j] = 0;
			e[i][j] = 0;
		}
		else {
			d[i][j] = MAX_L;
			e[i][j] = MAX_L;
		}
	}

	rep(i, 0, m) {
		ll a, b, c;
		cin >> a >> b >> c;
		a--; b--;
		d[a][b] = c;
		d[b][a] = c;
		e[a][b] = c;
		e[b][a] = c;
	}

	wf();

	ll ans = 0;

	rep(i, 0, n)rep(j, 0, n) {
		if (e[i][j] == MAX_L || d[i][j] == e[i][j]) {
			continue;
		}
		ans++;
	}

	cout << ans / 2 << endl;

	return 0;
}

Measured memory_bytes: 768
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <math.h>
#include <sstream>

using namespace std;

int main()
{
  int n = 5;
  vector<int> v(n);
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
  }
  sort(v.begin(), v.end());
  int ans = 1000000;
  do {
    int time = 0;
    for (int i = 0; i < n; ++i) {
      if (time % 10 != 0) {
	time += 10 - time % 10;
      }
      time += v[i];
    }
    ans = min(ans, time);
  } while (next_permutation(v.begin(), v.end()));
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 384
package main

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

type Node struct {
	Value int64
	Next  *Node
}

func main() {
	r := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()

	var base int64
	base = 1000000000 + 7

	var n int64
	fmt.Fscan(r, &n)

	first := &Node{
		Value: 0,
		Next:  nil,
	}

	tmp := first

	var a int64
	var sum int64
	for i := int64(0); i < n; i++ {
		fmt.Fscan(r, &a)
		newNode := &Node{
			Value: a,
			Next:  nil,
		}
		tmp.Next = newNode
		tmp = newNode

		sum += a
		sum %= base
	}

	var result int64

	iNode := first.Next
	for iNode != nil {
		// jNode := iNode.Next
		// for jNode != nil {
		// 	r := (iNode.Value * jNode.Value) % base
		// 	result += r
		// 	result %= base
		// 	jNode = jNode.Next
		// }

		if sum < iNode.Value {
			sum += base
		}
		sum -= iNode.Value
		sum %= base
		result += iNode.Value * sum
		result %= base
		iNode = iNode.Next
	}

	fmt.Fprintln(w, result)

}


Measured memory_bytes: 7460
#include<iostream>
#include<istream>
#include<string>
#include<map>
#include<cmath>
#include<algorithm>
#include<vector>
#include <cassert>
#include <algorithm>
#include <functional>
using namespace std;
int main()
{
    string S;
    cin >> S;
    int input_size = S.size();
    vector<string> v(input_size);
    int counter = 0;
    for(char s: S){
         v[counter] = s;
        ++counter;
    }
    if(input_size < 2 ) cout << 0;
    else{
    int trace_number = input_size - 2 + 1;
    int counter_1 = 0;
    for(int i = 0 ; i < trace_number ; ++i){
        if(v[i] == v[i+1]){
            if(v[i+1] == "1") v[i+1] = "0";
            else v[i+1] = "1";
            ++counter_1; 
        }
//            for(int j = 0 ; j < input_size; ++ j) cout << v[j];
//        cout << endl;
    }
    cout << counter_1 <<  endl;
   }
    return 0;
}


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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
template<class T> inline int chkmin(T& a, const T& val) {return val < a ? a = val, 1 : 0;}
template<class T> inline int chkmax(T& a, const T& val) {return a < val ? a = val, 1 : 0;}
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}
inline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}
inline int sign(ld x) {return x < -EPS ? -1 : x > +EPS;}
inline int sign(ld x, ld y) {return sign(x - y);}
#define db(x) cerr << #x << " = " << (x) << ", ";
#define endln cerr << "\n";
#define chkpt cerr << "-----\n";

const int maxn = 1e5 + 5;
int n, m;
int deg[maxn];

void solve() {
    cin >> n >> m;
    FOR(i, 0, m) {
        int u, v; cin >> u >> v; u--, v--;
        deg[u]++, deg[v]++;
    }
    FOR(i, 0, n) {
        if (deg[i] & 1) {
            cout << "NO\n";
            return;
        }
    }
    cout << "YES\n";
}

int main() {
    int JUDGE_ONLINE = 1;
    if (fopen("in.txt", "r")) {
        JUDGE_ONLINE = 0;
        assert(freopen("in.txt", "r", stdin));
        //assert(freopen("out.txt", "w", stdout));
    }
    else {
        ios_base::sync_with_stdio(0), cin.tie(0);
    }
    solve();
    if (!JUDGE_ONLINE) {
        //cout << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    }
    return 0;
}

Measured memory_bytes: 768
import math

a, b, h, m = map(int, input().split())
a_deg = h * 30 + m * 0.5
b_deg = m * 6
deg = abs(a_deg - b_deg) if abs(a_deg - b_deg) <= 180 else 360 - abs(a_deg - b_deg)
# print(f'{deg=}')
dis_sqrt = a**2 + b**2 - 2 * a * b * math.cos(math.radians(deg))
ans = math.sqrt(dis_sqrt)
print(ans)

Measured memory_bytes: 9568
import std.stdio;
import std.algorithm;
import std.range;
import std.conv;
import std.format;
import std.array;
import std.math;
import std.string;
import std.container;

int[100001] dp;

int solve(int n) {
  if (n == 0)
    return 0;

  if (dp[n] != -1)
    return dp[n];

  int ret = solve(n - 1) + 1;

  for (int d = 6; n - d >= 0; d *= 6)
    ret = min(solve(n - d) + 1, ret);

  for (int d = 9; n - d >= 0; d *= 9)
    ret = min(solve(n - d) + 1, ret);

  return dp[n] = ret;
}

void main() {
  int N; readlnTo(N);
  foreach(i; 0..N+1)
    dp[i] = -1;
  writeln(solve(N));
}

// helpers
void readlnTo(T...)(ref T t) {
  auto s = readln.split;
  assert(s.length == t.length);
  foreach(ref ti; t) {
    ti = s[0].to!(typeof(ti));
    s = s[1..$];
  }
}


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

int main(){
  vector<int> bucket(2);
  int x;
  for(int i = 0; i < 3; i++){
    cin >> x;
    if(x == 5) bucket.at(0)++;
    if(x == 7) bucket.at(1)++;
  }
  if(bucket.at(0)==2 && bucket.at(1)==1) cout << "YES" << endl;
  else cout << "NO" << endl;
}

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


int main(){
  
  int N;
  cin >> N;
  
  int ans=100,cut;
  
  for(int i; i<N; i++){
    int A;
    cin >> A;
    cut=0;
    while(A%2==0){
      A/=2;
      cut++;
    }
    ans=min(ans,cut);
  }
      
  
  cout << ans << endl;
}


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

int main() {
  int n;
  string s;
  cin >> n;
  cin >> s;
  string ans = ( n%2 == 0 ) ? "Yes" : "No";
  int half = n/2;
  for ( int i = 0; i < half; i++ ) {
    if ( s[i] != s[i+half] ) { ans = "No"; }
  }
  cout << ans << endl;
  return 0;
}


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

int main(){
  int K,i;
  int L;
  char S[101];
  
  scanf("%d\n",&K);
  scanf("%s",S);
  L=strlen(S);
  for(i=0;i<L;i++){
    if(i<K)
      printf("%c",S[i]);
    else{
      printf("...");
      break;
    }
  }
  printf("\n");
  
  return 0;
}

Measured memory_bytes: 1736
H, W = map(int, input().split())
a = []
for i in range(H):
    a.append([int(i) for i in input().split()])
ans = []
for j in range(H):
    if W == 1:
        break
    else:
        for i in range(W-1):
            if a[j][i]%2 != 0:
                a[j][i+1] +=1
                ans.append([j+1, i+1, j+1, i+2])
ls = []
for i in range(H):
    ls.append(a[i][-1])
for i in range(H-1):
    if ls[i]%2 != 0:
        ls[i+1] += 1
        ans.append([i+1, W, i+2, W])
print(len(ans))
for x in ans:
    print(*x)

Measured memory_bytes: 30108
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long int lli;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    lli l, r, d, ans=0;
    cin>>l>>r>>d;
    
    for(int i=l;i<=r;i++)
    {
        if(i%d == 0) ans++;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3652
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
using namespace std;

int main(){
	int H,W; cin>>H>>W;
	char a[110][110];
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			cin>>a[i][j];
		}
	}
	for(int i=0;i<=H+1;i++){
		for(int j=0;j<=W+1;j++){
			if(i==0||i==H+1){
				cout<<"#";
			}
			else if(j==0||j==W+1){
				cout<<"#";
			}
		    else{
					cout<<a[i-1][j-1];
			}
		}
		cout<<endl;
	}
	return 0;
	
}

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

  const int MOD = 1000000007;

  //long long
  using ll = long long;

  //出力系
  #define print(x) cout << x << endl
  #define yes cout << "Yes" << endl
  #define YES cout << "YES" << endl
  #define no cout << "No" << endl
  #define NO cout << "NO" << endl
  
  // begin() end()
  #define all(x) (x).begin(),(x).end()

  //for
  #define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

  //最大公約数（ll）
  ll gcd(ll x, ll y) { return y ? gcd(y,x%y) : x;}

  //素因数分解
  vector<pair<ll, int>>factorize(ll n){
    vector<pair<ll, int>> res;
    for(ll i = 2; i * i <= n; ++i){
      if(n % i) continue;
      res.emplace_back(i, 0);
      while(n % i == 0){
        n /= i;
        res.back().second++;
      }
    }
  if(n != 1) res.emplace_back(n, 1);
  return res;
  }


int main()
{
    string S;
    cin >> S;
    for(int i = 0; S.size() > i; i++){
        if(S.at(i) == 'A' && S.at(i + 1) == 'C') {
        cout << "Yes" << endl;
        return 0;
        }
        }

        
        
        cout << "No" << endl;
        
        
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(void){
  int a, b;
  cin >> a >> b;

  int ans = max({a + b, a - b, a * b});
  cout << ans << endl;
}


Measured memory_bytes: 3600
def gratest_common_factor(x,y):
    while y:
        amari = x % y

        x = y
        y = amari
    return x


n, x = map(int, input().split())
l = map(int, input().split())

l2 = list(map(lambda t: t-x, l))

for i in range(n-1):
    l2[1] = gratest_common_factor(l2[0],l2[1])
    del l2[0]

print(abs(l2[0]))




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

using namespace std;

int main() {

	long x, y;
	cin >> x >> y;

	if (x == 2 || y == 2 || x==11) { cout << "No" << endl; return 0; }
	if (x == 9 && y != 11) { cout << "No" << endl; return 0; }
	if (x == 6 && (y != 11 && y != 9)) { cout << "No" << endl; return 0; }
	if (x == 4 && (y != 11 && y != 9 && y != 6)) { cout << "No" << endl; return 0; }
	cout << "Yes" << endl;
}

Measured memory_bytes: 256
a = [list(map(int, input().split())) for _ in range(3)]
n = int(input())
for _ in range(n):
    b = int(input())
    for i in range(3):
        for j in range(3):
            if a[i][j] == b:
                a[i][j]=-1
for i in range(3):
    if a[i][0]==a[i][1]==a[i][2]==-1:
        print('Yes')
        exit()
    if a[0][i]==a[1][i]==a[2][i]==-1:
        print('Yes')
        exit()
if a[0][0]==a[1][1]==a[2][2]==-1 or a[0][2]==a[1][1]==a[2][0]==-1:
    print('Yes')
    exit()
print('No')

Measured memory_bytes: 38384
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Main m = new Main();
        m.solve();
    }
    private void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        List<Path>[] graph = new List[N];
        for (int i = 0; i < N; i++) {
            graph[i] = new ArrayList<>();
        }
        for (int i = 0; i < N - 1; i++) {
            int a = scan.nextInt()-1;
            int b = scan.nextInt()-1;
            long c = scan.nextLong();
            Path p1 = new Path(b, c);
            graph[a].add(p1);
            Path p2 = new Path(a, c);
            graph[b].add(p2);
        }
        int Q = scan.nextInt();
        int K = scan.nextInt()-1;
        Queue<Integer> queue = new LinkedList<>();
        long[] distances = new long[N];
        Arrays.fill(distances, Long.MAX_VALUE);
        distances[K] = 0;
        queue.add(K);
        while(!queue.isEmpty()) {
            int current = queue.poll();
            List<Path> neighbors = graph[current];
            for (Path p : neighbors) {
                if (distances[current] + p.cost < distances[p.to]) {
                    distances[p.to] = distances[current] + p.cost;
                    queue.add(p.to);
                }
            }
        }
        for (int i = 0; i < Q; i++) {
            int from = scan.nextInt() - 1;
            int to = scan.nextInt() - 1;
            System.out.println(distances[from] + distances[to]);
        }
    }

    class Path {
        int to;
        long cost;
        Path(int to, long cost) {
            this.to = to;
            this.cost = cost;
        }
    }
}


Measured memory_bytes: 181972
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define int long long
using namespace std;

typedef pair<int, int> Pii;

template<typename T>
void readvec(vector<T> &a);
void readindex(vector<int> &a);



signed main(){

    int N;
    cin >> N;
    vector<int> A(N), B(N), C(N);
    readvec(A);
    readvec(B);
    readvec(C);

    SORT(A);
    SORT(B);
    SORT(C);

    vector<int> B_C(N), B_A(N);
    //B_C[i]: B[i] < C[j] なるjの数
    REP(i, N){
        B_C[i] = distance(upper_bound(C.begin(), C.end(), B[i]), C.end());
    }
    //A_B[i]: B[i] > A[j] なるjの数
    REP(i, N){
        B_A[i] = distance(A.begin(), lower_bound(A.begin(), A.end(), B[i]));
    }

    int ans = 0;
    REP(i, N){
        ans += B_A[i] * B_C[i];
    }

    cout << ans;
    
    return 0;
}


template<typename T>
void readvec(vector<T> &a){
    REP(i, a.size()){
        cin >> a[i];
    }
}
void readindex(vector<int> &a){
    REP(i, a.size()){
        cin >> a[i];
        a[i]--;
    }
}

Measured memory_bytes: 4224
/* tempate
 *
 *
 */

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int (i)=(n); (i)>=(0); (i)--)
#define SIZE(x) ((int)(x).size())
#define GCD(a, b) int gcd(int a,int b){return b?gcd(b,a%b):a;}
#define QP(a, b) int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define all(v) (v).begin(),(v).end()


template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
template<typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

typedef vector<int, int> vint;
typedef pair<int,int> pint;
typedef vector<pint>vpint;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1LL << 60;
const ll MOD = 1000000007LL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, d; cin >> n >> d;
    vector<vector<ll>> x(n, vector<ll> (d, 0));
    ll ans = 0;
    rep(i, n){
        rep(j, d){
            cin >> x[i][j];
        }
    }
    rep(i, n){
        for(ll k = i + 1; k < n; k++){
            ll dis_dim2 = 0;
            rep(j, d){
                dis_dim2 += (abs(x[i][j] - x[k][j]) * abs(x[i][j] - x[k][j]));
            }
            double dis = sqrt(dis_dim2);
            if(ll(dis) * ll(dis) == dis_dim2) ans++;
        }
    }
    cout << ans;
    cout << endl;
    return 0;
}


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

int v,A[100][100],u,k,w;


int main(){
    cin >> v ;
    for (int i=0; i<v; ++i){
        cin >> u >> k;
        for(int j=0; j<k; ++j){
            cin >> w;
            A[u-1][w-1] = 1;
        }
    }
    for (int i=0; i<v; ++i){
        for (int j=0; j<v; ++j){
            cout << A[i][j];
            if (j < v-1)
            cout << " ";
        }
        cout << endl ;
    }
}

Measured memory_bytes: 1196
import sys
input = sys.stdin.readline
ab = [tuple(map(int, input().split())) for i in range(3)]
ans1 = [(1,3), (3,1), (2,3), (3,2), (2,4), (4,2)]
ans2 = [(1,3), (3,1), (1,4), (4,1), (2,4), (4,2)]
ans3 = [(1,2), (2,1), (2,3), (3,2), (3,4), (4,3)]
ans4 = [(1,2), (2,1), (1,4), (4,1), (3,4), (4,3)]
flg1 = False
flg2 = False
flg3 = False
flg4 = False
if (ab[0] in ans1) and (ab[1] in ans1) and (ab[2] in ans1):
    flg1 = True
if (ab[0] in ans2) and (ab[1] in ans2) and (ab[2] in ans2):
    flg2 = True
if (ab[0] in ans3) and (ab[1] in ans3) and (ab[2] in ans3):
    flg3 = True
if (ab[0] in ans4) and (ab[1] in ans4) and (ab[2] in ans4):
    flg4 = True

if flg1 or flg2 or flg3 or flg4:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using vec = vector<ll>;
using vect = vector<double>;
using Graph = vector<vector<ll>>;
#define loop(i, n) for (ll i = 0; i < n; i++)
#define Loop(i, m, n) for (ll i = m; i < n; i++)
#define pool(i, n) for (ll i = n; i >= 0; i--)
#define Pool(i, m, n) for (ll i = n; i >= m; i--)
#define mod 1000000007ll
#define flagcount __builtin_popcount
#define flag(x) (1 << x)
#define flagadd(bit, x) bit |= flag(x)
#define flagpop(bit, x) bit &= ~flag(x)
#define flagon(bit, i) bit &flag(i)
#define flagoff(bit, i) !(bit & (1 << i))
#define all(v) v.begin(), v.end()
#define low2way(v, x) lower_bound(all(v), x)
#define high2way(v, x) upper_bound(all(v), x)
#define idx_lower(v, x) (distance(v.begin(), low2way(v, x)))  //配列vでx未満の要素数を返す
#define idx_upper(v, x) (distance(v.begin(), high2way(v, x))) //配列vでx以下の要素数を返す
#define idx_lower2(v, x) (v.size() - idx_lower(v, x))         //配列vでx以上の要素数を返す
#define idx_upper2(v, x) (v.size() - idx_upper(v, x))         //配列vでxより大きい要素の数を返す
#define putout(a) cout << a << endl
#define Gput(a, b) G[a].push_back(b)
#define Sum(v) accumulate(all(v), 0ll)
#define gcd(x, y) __gcd(x, y)
ll ctoi(char c)
{
    if (c >= '0' && c <= '9')
    {
        return c - '0';
    }
    return 0;
}
template <typename T>
T lcm(T x, T y)
{
    T z = gcd(x, y);
    return x * y / z;
}
template <typename T>
bool primejudge(T n)
{
    if (n < 2)
        return false;
    else if (n == 2)
        return true;
    else if (n % 2 == 0)
        return false;
    double sqrtn = sqrt(n);
    for (T i = 3; i < sqrtn + 1; i++)
    {
        if (n % i == 0)
        {
            return false;
        }
        i++;
    }
    return true;
}
//場合によって使い分ける
//const ll dx[4]={1,0,-1,0};
//const ll dy[4]={0,1,0,-1};
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//2次元配列の宣言
//vector<vector<ll>> field(h, vector<ll>(w));

int main()
{
    cout << fixed << setprecision(30);
    ll n, m, k;
    cin >> n >> m >> k;
    vec a(n), b(m);
    loop(i, n) cin >> a[i];
    loop(i, m) cin >> b[i];
    vec ra(n + 1), rb(m + 1);
    ra[0] = 0;
    rb[0] = 0;
    loop(i, n) ra[i + 1] = ra[i] + a[i];
    loop(i, m) rb[i + 1] = rb[i] + b[i];
    ll nb = m;
    ll ans = 0;
    loop(i, n + 1)
    {
        ll now = ra[i];
        while (now + rb[nb] > k && nb > 0)
        {
            nb--;
            if (nb == 0)
                break;
        }
        if (now + rb[nb] <= k)
            ans = max(ans, i + nb);
    }
    putout(ans);
    return 0;
}


Measured memory_bytes: 9596
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const double eps = 1e-8;
const int NINF = 0xc0c0c0c0;
const int INF  = 0x3f3f3f3f;
const ll  mod  = 1e9 + 7;
const ll  N = 1e6 + 5;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	// isprime();
	ll n;
	cin>>n;
	if(n<=1){cout<<0<<'\n';return 0;}
	bool ok=false;
	for(ll i=2;1ll*i*i<=n;i++)
		if(n%i==0)
			{ok=true;break;}
	if(!ok){cout<<1<<'\n';return 0;}
	ll t=n;
	set<ll> s;
	map<ll,ll> M;
	for(ll i=2;1ll*i*i<=t && t!=1;i++){
		if(t%i==0){
			s.insert(i);
			while(t%i==0) t/=i,M[i]++;
		}
	}
	// cout<<"t="<<t<<'\n';
	ll ans=0;
	for(auto c:s){
		int j=1;
		// cout<<"M["<<c<<"]="<<M[c]<<" ";
		while(M[c]-j>=0) {
			ans++;
			M[c]-=j;
			j++;
			// cout<<"c="<<c<<" ans="<<ans <<" M[c]="<<M[c]<<" j="<<j<<'\n';
		}
	}
	if(t!=1) ans++;
	cout<<ans<<'\n';
	return 0;
}

Measured memory_bytes: 3664
import sys
import math


def input():
    return sys.stdin.readline().rstrip()


def main():

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

    count = 0
    for i in range(101,0,-1):
        if A%i ==0 and B% i ==0:
            count +=1

        if count ==K:
            print(i)
            exit()



if __name__ == "__main__":
    main()


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

int main(){
  int sum = 0;
  rep(i,3){
    int a;
    cin >> a;
    sum += a;
  }
  if( sum <= 21 ) cout << "win" << endl;
  else cout << "bust" << endl;
}
    


Measured memory_bytes: 256
//C
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

//C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

//Others
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;
}
const int dx[8] = { -1, 0, 1, -1, 1, -1, 0, 1 };
const int dy[8] = { 1, 1, 1, 0, 0, -1, -1, -1 };
const int lr[4] = { 0, 1, 0, -1 };
const int ud[4] = { 1, 0, -1, 0 };



//LOVE Ayane Sakura



using namespace std;



int main() {
	int N;
	cin >> N;
	vector<int>v(N);
	vector<int>vc(N);
	for (int i = 0; i < N; i++) {
		cin >> v[i];
		vc[i] = v[i];
	}
	int M, m;
	M = m = 0;
	int check = 0;
	for (int i = 0; i < N; i++) {
		if (M <= vc[i]) {
			check = i;
			chmax(M, vc[i]);
		}
	}
	vc[check] = 0;
	for (int i = 0; i < N; i++) {
		chmax(m, vc[i]);
	}
	for (int i = 0; i < N; i++) {
		if (v[i] == M) {
			cout << m << endl;
		}
		else {
			cout << M << endl;
		}
	}
}



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

using namespace std;

typedef long long int ll;
#define MAXSIZE 10000000;

const int MAX = 510000;
const int MOD = 1000000007;
const long long INF = 1LL << 60;

ll dp[10001][1001] ={ 0 };

int main()
{
    int N;
    string S;

    cin >>N>>S;

    int ans = 0;

    for (int i = 0; i <=999; i++) {
        string code = to_string(i);
        if (i <= 9) {
            code = "0" + code;
            code = "0" + code;
        }
        else if (10 <= i && i <= 99) {
            code = "0" + code;
        }

        int codeInd = 0;
        for (int j = 0; j < N; j++) {
            if (code[codeInd] == S[j])codeInd++;
        }

        if (codeInd == 3) {
            ans++;
        }
    }

    cout <<ans<<endl;
}

/*Syakutori
while(cin >>b && b)){
      ll t = 1;
      long long int ansS = 1,ansT=0;
      long long int sum = 0;

      for(ll s = 1;s < 50000000;s++){

        while(t <  50000000 && sum+Rsum[t] < b){
          sum += Rsum[t];
          t++;
        }
        if(b == sum+Rsum[t]){
          if(ansT - ansS < t-s){
            ansS = s;
            ansT = t;
          }
          cout <<ansS<<" "<<ansT-ansS + 1<<endl;
          break;
        }
        if(t == s)++t;
        else sum -= Rsum[s];
        }
    }

//priority_queue<long long int,vector<long long int>, greater<long long int>> PQ;
//priority_queue<long long int> PQ1;

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

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


*/


Measured memory_bytes: 3712
a,b,c,d=input().split(' ')
a=int(a)
b=int(b)
c=int(c)
d=int(d)
var=1
while(var==1):
  c=c-b
  a=a-d
  if (a<=0):
      break
if (c<=0):
  print("Yes")
else:
  print("No")
  
  

Measured memory_bytes: 9000
def main():
    import heapq
    n,m = map(int,input().split())
    a = list(map(int,input().split()))
    A = []
    for i in range(n):
        heapq.heappush(A,-1*a[i])
    for i in range(m):
        a = heapq.heappop(A)
        a = (-1*a)//2
        heapq.heappush(A,-1*a)
    print(-1*sum(A))

if __name__ == "__main__":
    main()


Measured memory_bytes: 20464
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}


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

    REP(i,s.size()) {
        cout << s[i];
        if (i==3) {
            cout << " ";
        }
    }
    cout << endl;


    return 0;
}


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

int main() {
    int n, k;
    ll ans1 = 0, ans2 = 0;
    cin >> n >> k;
    // n以下, kの倍数
    REP(i, 1, n+1) {
        if (i % k == 0) ans2++; // 2
        else if (2 * i % k == 0) ans1++; // 1 3
    }
    ans1 = pow(ans1, 3);
    ans2 = pow(ans2, 3);
    cout << ans1 + ans2 << endl;
    return 0;
}

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

#define ONLINE_JUDGE
#define pb(a) push_back(a)
#define ALL(a) a.begin(), a.end()
#define FOR(x,to) for(x=0;x<(to);x++)

using ll = long long;

const int E5 = 1e5;

//////////// Solution /////////////////////////////////

void solve() {
	int N,M,X;
	int A[101];
	cin >> N >> M >> X;
	int s1=0,s2=0;
	for (int i = 1; i <= M; ++i) {
		cin >> A[i];
		if (A[i] < X) {
			++s1;
		} else {
			++s2;
		}
	}

	cout << min(s1,s2) << '\n';
}	

/////////// End Solution ///////////////////////////////////////

//////// Initialization ////////////////////////////////////

int main() {

	#ifndef ONLINE_JUDGE
	FILE *FIN = freopen("/home/danil/prog/input.txt", "r", stdin);
	clock_t time_start = clock();
	#endif

	ios::sync_with_stdio(false);
	cin.tie(NULL);

	solve();

	#ifndef ONLINE_JUDGE
	fclose(FIN);
	cerr << "\x1b[031m\n-----------------\nTime=" << (ll)((double)(clock()-time_start) / CLOCKS_PER_SEC * 1000) << "ms\n\x1b[0m";
	#endif

	return 0;
}

//////// End Initialization ///////////////////////////////////////


Measured memory_bytes: 256