akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.*;

public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static long cnt=0;
	public static void main(String[] args) throws Exception {
		solution(args);
		if(in!=null){
			in.close();
		}
	}

	public static void solution(String[] args) throws Exception{
		int N = nextInt();
		int u = nextInt()-1;
		int v = nextInt()-1;

		ArrayList<Integer>[] tree = new ArrayList[N];
		for(int i=0;i<N;i++){
			tree[i]=new ArrayList<>();
		}

		for(int i=0;i<N-1;i++){
			int a=nextInt();
			int b=nextInt();
			tree[a-1].add(b-1);
			tree[b-1].add(a-1);

		}
		if(u==v){
			System.out.println(0);
			return;
		}
		int[] uSet = new int[N];

		int[] vSet = new int[N];

		dfs(v,0,tree,v,vSet);
		dfs(u,0,tree,u,uSet);

		int ans = 0;
		for(int i=0;i<N;i++){
			if(vSet[i]>uSet[i]){
				ans=Math.max(ans, vSet[i]-1);
			}
		}

			System.out.println(ans);
	}

	public static void dfs(int n,int cnt,ArrayList<Integer>[] tree,int parent,int[] set){
		if(n!=parent&&tree[n].size()==1){
			set[n]=cnt;
			return;
		}
		for(int x:tree[n]){
			if(x==parent){
				continue;
			}
			dfs(x,cnt+1,tree,n,set);
		}
	}


	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}

}



Measured memory_bytes: 75724
import sys
s = sys.stdin.read()
# s = input()
alpha = "abcdefghijklmnopqrstuvwxyz"
cnt = [0] * len(alpha)
for i in s:
    for j in range(len(alpha)):
        if str.lower(i) == alpha[j]:
            cnt[j] += 1
for i in range(len(alpha)):
    print(alpha[i], ":", cnt[i])


Measured memory_bytes: 5568
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ll N, D;
    cin>>N>>D;

    int ans = 0;
    for(int i=0; i<N; i++){
        ll x, y;
        cin>>x>>y;

        if(D*D >= x*x+y*y){
            ans++;
        }
    }
    cout<<ans<<endl;

    return 0;
}

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

typedef long long ll;

main()
{
    int n, i, j, c = 0, a, b;
    cin >> n;
    for(i = 0; i < n; i++){
        cin >> a >> b;
        if(a == b){
            c++;
        }
        else if(c < 3){
            c = 0;
        }
    }
    if(c >= 3){
        cout << "Yes";
    }
    else{
        cout << "No";
    }


}





///promy_pompom
//hello world


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do { (t*=10)+=ch-'0'; ch=getchar(); } while ('0'<=ch&&ch<='9'); t*=f;
}
typedef long long ll;
int n;
ll ans,a,b,c;
int main() {
	//freopen("1.txt","r",stdin);
	read(n);
	for (int i=1;i<=n;i++) {
		a=i,b=(n/i)*i,c=(b-a)/i+1;
		ans+=(a+b)*c/2;
	}
	printf("%lld\n",ans);
	return 0;
}
/*
  0. Enough array size? Enough array size? Enough array size? Interger overflow?
  
  1. Think TWICE, Code ONCE!
  Are there any counterexamples to your algo?
    
  2. Be careful about the BOUNDARIES!
  N=1? P=1? Something about 0?
    
  3. Do not make STUPID MISTAKES!
  Time complexity? Memory usage? Precision error?
*/

Measured memory_bytes: 3760
fn main() {

    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();//&str型?
    let s = buf.trim();//&str型?

    match s {//&*sでもOK
        "Sunny" => println!("Cloudy"),
        "Cloudy" => println!("Rainy"),
        "Rainy" => println!("Sunny"),
        _ => ()
    }
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define forin(in) for(int i=0; i<(int)in.size(); i++) cin>>in[i]
#define forout(out) for(int i=0; i<(int)out.size(); i++) cout<<out[i]<<endl
#define rep(i, n) for(int i=0; i<(n); i++)

int main() {
    const int mod = 1000000007;
    int n; cin>> n;
    vector<ll> a(n);
    vector<ll> b(n+1, 0);
    rep(i, n){
        cin>> a[i];
        b[i+1] = b[i] + a[i];
    }

    ll ans = 0;
    rep(i, n){
        ll sum = (b[n] - b[i+1]) % mod;
        ans += a[i] * sum;
        ans %= mod;
    }
    cout<< ans << endl;
}


Measured memory_bytes: 6300
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>

using namespace std;

int main(){

  int n, m;
  cin >> n >> m;

  string a[n][n];
  string b[m][m];

  string tmp;
  for (int i = 0; i < n; i++){
    cin >> tmp;
    for (int j = 0; j < n; j++){
      a[i][j] = tmp[j];
    }
  }
  for (int i = 0; i < m; i++){
    cin >> tmp;
    for (int j = 0; j < m; j++){
      b[i][j] = tmp[j];
    }
  }

  // judge
  for (int i = 0; i <= n - m; i++){
    for (int j = 0; j <= n - m; j++){

      int flag = 0;
      for (int m1 = 0; m1 < m; m1++){
        for (int m2 = 0; m2 < m; m2++){

          if (a[i + m1][j + m2] == b[m1][m2]){
            flag += 1;
          }

        }
      }

      if (flag == m * m){
        cout << "Yes" << endl;
        return 0;
      }

    }
  }

  cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
 
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int  long long
#define rep(i,a,b)    for(int i=a;i<b;i++)
#define repn(i,a,b)   for(int i=a;i>=b;i--)
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define pb push_back
#define mp  make_pair
#define all(v) (v).begin(), (v).end()
#define mod 1000000000007
#define mod2 998244353
 
int fexp(int a, int b){int ans = 1;while(b){if(b&1) ans = ans*a%mod2; b/=2;a=a*a%mod2;}return ans;}
int inverse(int a, int p){return fexp(a, p-2);}
 
 
void solve(){
	string s;
	cin>>s;
	if(s[2]==s[3]&&s[4]==s[5])cout<<"Yes";
	else cout<<"No";
	return;
} 
signed main(){
	IOS;
	// int n;  cin>>n;  rep(i,0,n){solve();cout<<endl;}
	solve();
	return 0;
}

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

using namespace std;

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

  const char& last = S[S.size()-1];
  
  if (last == 's') {
      cout << (S + "es") << endl;
  } else {
    cout << (S + "s") << endl;
  }

  return 0;
}


Measured memory_bytes: 3040
n = int(input())
a = list(input())
cnt_r = n-1
cnt_l = 0
cnt = 0
while True:
  if cnt_r == cnt_l:
    print(cnt)
    exit()
  if a[cnt_r] == 'W':
    cnt_r -= 1
    continue
  if a[cnt_l] == 'R':
    cnt_l += 1
    continue
  a[cnt_r], a[cnt_l] = a[cnt_l], a[cnt_r]
  cnt += 1

Measured memory_bytes: 10784
import java.util.*;

class SmallLargeOrEqual {
    public static void main(String...args) {
        final Scanner sc = new Scanner(System.in);
        final int a = sc.nextInt();
        final int b = sc.nextInt();
        System.out.println(a < b ? "a < b" : a > b ? "a > b" : "a == b");
    }
}
public class Main {
    public static void main(String... args) {
        SmallLargeOrEqual.main();
    }
}

Measured memory_bytes: 17164
S = input()
if (S[0]==S[1] and S[2]==S[3]) or (S[0]==S[2] and S[1]==S[3]) or (S[0]==S[3] and S[1]==S[2]):
  if not(S[0]==S[1]==S[2]==S[3]):
    print("Yes")
  else:
    print("No")
else:
  print("No")

Measured memory_bytes: 3060
extern crate core;

use std::io::{self, Read};

#[macro_export]
macro_rules! input {
  ($s:expr=>$($t:tt)*) => {
    let mut lines=$s.split("\n");
    $(
        line_parse!(lines,$t);
    )*
  };
}

macro_rules! line_parse {
  ($lines:expr,($($name:ident:$t:tt)*)) => {
    let mut line=$lines.next().unwrap().split_whitespace();
    $(value_def!(line,$name,$t);)*
  };

  //複数行
  ($lines:expr,{$n:expr;$name:ident:$t:tt}) => {
    values_def!($lines,$n,$name,$t);
  };
}

macro_rules! value_def {
    ($line:expr, $name:ident, $t:tt) => {
        let $name = value!($line, $t);
    };
}

macro_rules! values_def {
    ($lines:expr, $n:expr, $name:ident, $t:tt) => {
        let $name = {
            let mut vec = Vec::new();
            for i in 0..$n {
                let mut next = $lines.next().unwrap().split_whitespace();
                vec.push(value!(next, $t));
            }
            vec
        };
    };
}

macro_rules! value {
  //配列
  ($line:expr,[$t:tt]) => {
    $line.map(|x|{
      let mut iter=::std::iter::once(x);
      value!(iter,$t)
    }).collect::<Vec<_>>()
  };
  //タプル
  ($line:expr,($($t:tt),*)) => {
    ($(value!($line,$t),)*)
  };
  //文字列
  ($line:expr,#) => {
    $line.next().unwrap()
  };
  //単一値
  ($line:expr,$t:ty) => {
    $line.next().unwrap().parse::<$t>().unwrap()
  };
  //インデックス(-1)
  ($line:expr,@) => {
    $line.next().unwrap().parse::<usize>().unwrap()-1
  };
}

fn main() {
    let mut input = String::new();
    io::stdin().read_to_string(&mut input).unwrap();
    let output = solve(input.trim().to_string());
    println!("{}", output);
}

fn solve(input: String) -> String {
    input!(input=>(s:#)(k:i64));
    let mut one_count = 0;
    let mut last = 0;
    for x in s.chars().map(|x| x.to_string().parse::<i64>().unwrap()) {
        if x == 1 {
            one_count += 1;
        } else {
            last = x;
            break;
        }
    }
    if one_count >= k { 1 } else { last }.to_string()
}

macro_rules! tests {
    ($($name:ident: $input:expr=>$output:expr,)*) => {
        mod tests {
            $(
                #[test]
                fn $name() {
                    assert_eq!($output.trim().to_string(),super::solve($input.trim().to_string()));
                }
            )*
        }
    }
}

tests! {
    test1: "1214\n4" => "2",
    test2: "3\n157" => "3",
    test3: "299792458\n9460730472580800" => "2",
}


Measured memory_bytes: 4352
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

   class Main {
     public static void main(String[]args){
         Scanner scan = new Scanner(System.in);
         BigInteger a = scan.nextBigInteger();
         BigInteger b = scan.nextBigInteger();
         BigInteger x = scan.nextBigInteger();
         BigInteger i = b.divide(x ).add(BigInteger.valueOf(1))   ;
         BigInteger j = a.divide(x).add(BigInteger.valueOf(1));
         BigInteger g   = ( i.subtract(j) )  ;
            
         if(a.mod(x).intValue() != 0){
            System.out.println(g  );
         }else{
            System.out.println(g .add(BigInteger.valueOf(1)));    
         }
     }
}


Measured memory_bytes: 22868
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        FastReader s = new FastReader();
        int a = s.nextInt();
        System.out.println(a+(a*a)+a*a*a);
    }

    private static boolean isPrime(int n) {
        if (n == 2)
            return true;
        else if ((n % 2 == 0 && n > 2) || n < 2)
            return false;
        else {
            for (int i = 3; i <= (int) Math.sqrt(n); i += 2) {
                if (n % i == 0)
                    return false;
            }
            return true;
        }


    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

}

Measured memory_bytes: 25332
from collections import deque
H, W = map(int, input().split())
gridgraph = [list(input()) for _ in range(H)]
distance = [[50000]*W for _ in range(H)]
q = deque()
for i in range(H):
    for j in range(W):
        if gridgraph[i][j] == "#":
            q.append([i, j])
            distance[i][j] = 0
adjacent = [[1, 0], [0, 1], [-1, 0], [0, -1]]
while len(q):
    cy, cx = q.popleft()
    for dy, dx in adjacent:
        ny, nx = cy+dy, cx+dx
        if ny < 0 or ny >= H or nx < 0 or nx >= W:
            continue
        if distance[ny][nx] != 50000:
            continue
        distance[ny][nx] = distance[cy][cx] + 1
        q.append([ny, nx])
ans = 0
for d in distance:
    ans = max(ans, max(d))
print(ans)


Measured memory_bytes: 176476
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef  unsigned long long int ull;
typedef pair<ll,ll> P;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
//ios_base::sync_with_stdio(false);
//cin.tie(NULL);
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
bool cnt[100005];
ll wa[100005];
int main(){
    int n,m;
    cin>>n>>m;
    for(int i=0;i<=n;i++)cnt[i]=0;
    ll ac=0,w=0;
    for(int i=0;i<m;i++){
       int a;string s={};
       cin>>a;cin>>s;
       if(cnt[a])continue;
       if(s=="AC"&&!cnt[a]){
            ac++;
            cnt[a]=true;
       }
       if(s=="WA"&&!cnt[a])wa[a]++;
    }
    for(int i=0;i<=n;i++)if(cnt[i])w+=wa[i];
    cout<<ac<<" "<<w<<endl;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
#define REV_WHOLE(v) (v).rbegin(), (v).rend()
using i64 = int64_t;
using namespace std;
template <size_t I, class H, class... T> struct TupleReaderWriter{static tuple<H,T...> r(istream&i){H v;i>>v;return tuple_cat(tuple<H>(v),TupleReaderWriter<sizeof...(T)-1,T...>::r(i));}static void w(ostream&o,tuple<H,T...>&t,string d){TupleReaderWriter<I-1,H,T...>::w(o,t,d);o<<d<<get<I>(t);}};
template <class H, class... T> struct TupleReaderWriter<0,H,T...>{static tuple<H,T...> r(istream&i){H v;i>>v;return tuple<H>(v);}static void w(ostream&o,tuple<H,T...>&t,string d){o<<get<0>(t);}};
template<class T>istream&operator>>(istream&i,vector<T>&v){for(auto&x:v)i>>x;return i;}
template<class T>ostream&operator<<(ostream&o,vector<T>&v){string delim="";for(auto&x:v)o<<delim<<x,delim=" ";return o;}
template <class... T> istream& operator>>(istream&i,tuple<T...>& t) { t = TupleReaderWriter<sizeof...(T), T...>::r(i); return i; }
template <class... T> ostream& operator<<(ostream& o, tuple<T...>& t) { string delim = " "; TupleReaderWriter<sizeof...(T) - 1, T...>::w(o, t, delim); return o; }
template<typename T> using rev_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<typename T> using vector2d = vector<vector<T>>;
void R_YESNO(bool p) { cout << (p ? "YES" : "NO") << endl; }
void R_YesNo(bool p) { cout << (p ? "Yes" : "No") << endl; }

const i64 MOD = 998244353;

// O(log a)
int64_t powmod(int64_t a, int64_t p) {
    int64_t value = 1;
    for (int64_t mul = a; p > 0; p >>= 1, mul = (mul * mul) % MOD) {
        if (p & 1) value = (value * mul) % MOD;
    }
    return value;
}

int main() {
    int N;
    cin >> N;
    vector<i64> D(N);
    vector<i64> A(N, 0);
    for(int i = 0; i < N; i++) {
        cin >> D[i];
        A[D[i]]++;
    }
    i64 ans = 1;
    if(D[0] != 0 || A[0] > 1) ans = 0;
    for(int i = 0; i < N - 1; i++) {
        if(A[i] == 0 && A[i + 1] == 0) continue;
        ans *= powmod(A[i], A[i + 1]);
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
	int n,m;
	int henkan[256];
	while(cin>>n,n){
		memset(henkan,0,sizeof(henkan));
		while(n--){
			char a,b; cin>>a>>b;
			henkan[(int)a] = b;
		}
		cin>>m;
		while(m--){
			char a; cin>>a;
			printf("%c",henkan[(int)a]?:a);
		}
		puts("");
	}
	return 0;
}

Measured memory_bytes: 840
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define int long long
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}


int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int n, m;

signed main() {
	cin >> n >> m;
	if (n == m)cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
int gcd(int a,int b)
{
    return a==0?b:gcd(b%a,a);
}
int GCD(int a,int b,int c)
{
    return gcd(a,gcd(b,c));
}
int main()
{
    int n;
    scanf("%d",&n);
    int ans=0;
    for(int i=1;i<=n;i++)
        for(int j=1;j<=n;j++)
            for(int k=1;k<=n;k++)
                ans+=GCD(i,j,k);
    printf("%d\n",ans);
    return 0;
}


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

int main() {
    int n;
    cin >> n;
    vector<pair<int, int>> xy(n);
    for (auto& e : xy) cin >> e.first >> e.second;

    int m = (abs(xy[0].first) + abs(xy[0].second)) % 2, l = m;
    for (int i = 1; i < n; i++) {
        if ((abs(xy[i].first) + abs(xy[i].second)) % 2 != m) {
            cout << -1 << endl;
            return 0;
        }
    }

    vector<int> arms;
    for (int i = 30; i >= 0; i--) arms.push_back(1 << i);
    if (m == 0) arms.push_back(1);

    cout << arms.size() << endl;
    for (auto e : arms) cout << e << " ";
    cout << endl;

    for (auto& e : xy) {
        int u = e.first + e.second, v = e.first - e.second;
        string op = "";
        for (auto& d : arms) {
            if (u > 0 && v > 0) u -= d, v -= d, op += 'R';
            else if (u > 0 && v <= 0) u -= d, v += d, op += 'U';
            else if (u <= 0 && v > 0) u += d, v -= d, op += 'D';
            else u += d, v += d, op += 'L';
        }
        cout << op << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <utility>
using namespace std ;
int main (){
int n , t , ti = -1 , tc = 1001 ;
scanf ("%d%d",&n,&t) ;
pair<int,int> arr[101] ;
for ( int i = 0 ; i < n ; i++ )
{
scanf("%d%d",&arr[i].first,&arr[i].second) ;
if ( arr[i].first < tc ) { if ( arr[i].second <= t ) { tc = arr[i].first ; ti = i ; } }
}
if ( ti != -1 ) printf("%d\n",tc ) ;
else puts("TLE\n") ;
return 0 ;
}

Measured memory_bytes: 256
package main

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

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() (int, []int) {
	n := readInt()
	return n, readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int

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

func main() {
	defer stdout.Flush()
	n := readInt()
	x := readInt()
	m := make([]int, n)
	min := math.MaxInt32
	for i := range m {
		m[i] = readInt()
		if m[i] < min {
			min = m[i]
		}
		x -= m[i]
	}
	println(n + x/min)

}

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


Measured memory_bytes: 640
#include<iostream>
using namespace std;
int a[40],b[40],c[40];
int dp[41][401][401];
int main(){
	int n,ma,mb;
	cin >> n >> ma >> mb;
	for(int i=0;i<n;i++) cin >> a[i] >> b[i] >> c[i];
	for(int i=0;i<=n;i++){
		for(int ca=0;ca<=400;ca++){
			for(int cb=0;cb<=400;cb++){
				dp[i][ca][cb]=4001;
			}
		}
	}
	dp[0][0][0]=0;
	for(int i=0;i<n;i++){
		for(int ca=0;ca<=400;ca++){
			for(int cb=0;cb<=400;cb++){
				if(dp[i][ca][cb]==4001) continue;
				dp[i+1][ca][cb]=min(dp[i+1][ca][cb],dp[i][ca][cb]);
				dp[i+1][ca+a[i]][cb+b[i]]=min(dp[i+1][ca+a[i]][cb+b[i]],dp[i][ca][cb]+c[i]);

			}
		}
	}
	int ans=4001;
	for(int ca=1;ca<=400;ca++){
		for(int cb=1;cb<=400;cb++){
			if(ca*mb==cb*ma) ans=min(ans,dp[n][ca][cb]);
		}
	}	
	if(ans==4001) cout << -1 << endl;
	else cout << ans << endl;
	return 0;
}


Measured memory_bytes: 25984
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		String str="";
		String conv_str="";

		Scanner sc= new Scanner( System.in );
		str = sc.nextLine();

		for ( int i = 0 ; i < str.length() ; i++ ) {
			if(Character.isUpperCase(str.charAt(i))) {
				conv_str += String.valueOf(str.charAt(i)).toLowerCase();
			}else if(Character.isLowerCase(str.charAt(i))) {
				conv_str += String.valueOf(str.charAt(i)).toUpperCase();
			}else {
				conv_str += String.valueOf(str.charAt(i));
			}
		}

		System.out.println( conv_str );

		sc.close();
	}
}



Measured memory_bytes: 31780
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
from fractions import gcd
import sys
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = float('inf')


n, m = Is()
M = []
for i in range(m):
    ks = LI()
    mask = 0
    for s in ks[1:]:
        mask += 1 << (s-1)
    M.append(mask)
P = LI()


ans = 0
for bit in range(1 << n):
    for i in range(m):
        if bin(bit & M[i]).count("1") % 2 != P[i]:
            break
    else:
        ans += 1
print(ans)


Measured memory_bytes: 64876
#include<cstdio>
#include<map>
#include<algorithm>
#define N 1000400
using namespace std;
int n,v2[N],fa[N];
long long v[N],sz[N],ds[N];
map<long long,int> tp;
bool cmp(int a,int b){return v[a]<v[b];}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%lld",&v[i]),tp[v[i]]=i,v2[i]=i,sz[i]=1;
	sort(v2+1,v2+n+1,cmp);
	for(int i=n;i>1;i--)
	{
		long long tp2=v[v2[i]]-n+sz[v2[i]]*2;
		if(!tp[tp2]){printf("-1\n");return 0;}
		int sb=tp[tp2];
		ds[sb]+=ds[v2[i]]+sz[v2[i]];
		sz[sb]+=sz[v2[i]];
		fa[v2[i]]=sb;
	}
	if(ds[v2[1]]!=v[v2[1]]){printf("-1\n");return 0;}
	for(int i=1;i<=n;i++)if(fa[i])printf("%d %d\n",i,fa[i]);
}//111222333

Measured memory_bytes: 20736
#include <iostream>
#include <numeric>
using i64 = long long;

int main() {
    int n;
    std::cin >> n;

    i64 s = 0;
    for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) {
        const int g = std::gcd(i, j);
        for (int k = 1; k <= n; k++) s += std::gcd(k, g);
    }

    std::cout << s << std::endl;

    return 0;
}


Measured memory_bytes: 3608
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    static class CRemainderMinimization2019
    {
        static void Main(string[] args)
        {
            var lr = Console.ReadLine().Split(' ').Select(y => long.Parse(y)).ToList();
            long l = lr[0];
            long r = lr[1];

            if (r - l >= 2019)
            {
                Console.WriteLine(0);
                Console.ReadLine();
                return;
            }

            long min = long.MaxValue;

            for (long i = l; i < r; i++)
            {
                for (long j = l + 1; j <= r; j++)
                {
                    min = Math.Min(min, i * j % 2019);
                    if (min == 0)
                    {
                        Console.WriteLine(min);
                        Console.ReadLine();
                        return;
                    }
                }
            }

            Console.WriteLine(min);
            Console.ReadLine();
        }
    }
}

Measured memory_bytes: 11220
#include <stdio.h>

int main(void){
  int N;
  int A;
  int B;
  scanf("%d", &N);
  if (N == 1){
    printf("Hello World\n");
  }else{
    scanf("%d", &A);
    scanf("%d", &B);
    printf("%d\n", A+B);
  }
  return 0;
}

Measured memory_bytes: 128
S = input()
T = input()

n = len(S)
m = len(T)

def check(s, t):
    for i in range(len(s)):
        if s[i] == "?":
            continue
        if s[i] != t[i]:
            return False
    return True

p = []
for i in range(n-m+1):
    s = S[i:i+m]
    if check(s, T):
        p.append(i)

if p == []:
    print("UNRESTORABLE")
    exit()

plast = p[-1]
ans = S[:plast] + T + S[plast+m:]
print(ans.replace("?", "a"))


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

int a[100005];
int main()
{
	int n,sum=0,ans=0;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	for(int i=1;i<n;i++)
	{
		if(a[i]>=a[i+1])
		{
			sum++;
		}
		else
		{
			sum=0;
		}
		ans=max(ans,sum);
	}
	cout<<ans<<'\n';
    return 0;
}

Measured memory_bytes: 640
#pragma GCC optimize("Ofast")
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>
#include<queue>

using namespace std;

int main(){	
	
	long long a,b;
	int k;
	cin >> a >> b >> k;
	for(int i=0;i<k;i++){
		if(i%2==0){
			if(a%2==1){
				a--;
			}
			a/=2;
			b+=a;
		}else{
			if(b%2==1){
				b--;
			}
			b/=2;
			a+=b;
		}
	}
	cout << a << " " << b << endl;
	return 0;
}


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

#define int long long
#define str string
#define rep(x,y) for(int i=x;i<y;i++)
#define REP(x,y) for(int j=x;j<y;j++)
#define all(x) x.begin(),x.end()
#define vint vector<int>
#define vchar vector<char>
#define vstr vector<string>
#define pb(n) push_back(n)

signed main(){
  int A,B,N,M,count=0,count2=0,count3=0,stack=0;
  str S,T;
  int C='A'-'a';
  cin>>N>>M;
  vstr W(N);
  vint l(N);
  vector<vchar> a(N,vchar(M));
  rep(0,N){
    REP(0,M)cin>>a.at(i).at(j);
  }
  rep(0,M+2)cout<<'#';
  cout<<endl;
  rep(0,N){
    cout<<'#';
    REP(0,M)cout<<a.at(i).at(j);
    cout<<'#'<<endl;
  }
  rep(0,M+2)cout<<'#';
  cout<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>
int main() {
  int d,count,length,a;
  char cs[201],tmp[201];
  while(true) {
    length = 0;
    scanf("%s",cs);
    if (cs[0] == '-') break;
    for (int i = 0; cs[i] != '\0'; i++) length++;
    scanf("%d", &count);
    for (int i = 0; i < count; i++) {
      a = 0;
      scanf("%d", &d);
      for (int j = d; j < length; j++) tmp[a++] = cs[j];  
      for (int k = 0;k < d; k++) tmp[a++] = cs[k];
      for (int l = 0; l<length; l++) {
        cs[l] = tmp[l];
      }
    }
    printf("%s\n", cs);
  }
  return 0;
}



Measured memory_bytes: 2512
def checker(N, Y):
    for yen_10000 in range(N + 1):
        for yen_5000 in range(N - yen_10000 + 1):
            yen_1000 = N - yen_10000 - yen_5000
            value = 10000 * yen_10000\
                  + 5000  * yen_5000\
                  + 1000  * yen_1000

            if value == Y:
                return yen_10000, yen_5000, yen_1000
    return -1, -1, -1

def main():
    N, Y = map(int, input().split())
    ret = checker(N, Y)
    print("{} {} {}".format(ret[0], ret[1], ret[2]))

main()

Measured memory_bytes: 3060
#!/usr/bin/env python3
from bisect import bisect
import sys
input = sys.stdin.readline
A, B, Q = map(int, input().split())
INF = 10**18
s = [-INF] + [int(input()) for _ in range(A)] + [INF]
t = [-INF] + [int(input()) for _ in range(B)] + [INF]
for _ in range(Q):
    x = int(input())
    sl = s[bisect(s, x) - 1]
    sr = s[bisect(s, x)]
    tl = t[bisect(t, x) - 1]
    tr = t[bisect(t, x)]
    ans = INF
    ans = min(ans, max(abs(x - sl), abs(x - tl)))
    ans = min(ans, max(abs(x - sr), abs(x - tr)))
    ans = min(ans, min(abs(x - sl), abs(x - tr)) * 2 + max(abs(x - sl), abs(x - tr)))
    ans = min(ans, min(abs(x - sr), abs(x - tl)) * 2 + max(abs(x - sr), abs(x - tl)))
    print(ans)


Measured memory_bytes: 12816
#include <bits/stdc++.h>
// #include <atcoder/all>
#define ll long long int
#define ld long double
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, n) for (ll i = 1; i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
// using namespace atcoder;
void Main()
{
    ll n;
    cin >> n;

    string S1, S2;
    cin >> S1 >> S2;

    int mode = -1;
    vector<ll> dp(n);
    if (S1[0] == S2[0]) {
        mode = 0;
        dp[0] = 3;
    }
    else {
        mode = 1;
        dp[0] = 6;
    }

    ll mod = 7LL + 1e9;
    repi(i, n) {
        if (mode == 1) {
            mode = 2;
            dp[i] = dp[i-1] % mod;
        }
        else {
            ll prev = mode;

            if (S1[i] == S2[i]) {
                mode = 0;
                if (prev == 0) {
                    dp[i] = dp[i-1] * 2 % mod;
                }
                else {
                    dp[i] = dp[i-1] % mod;
                }
            }
            else {
                mode = 1;
                if (prev == 0) {
                    dp[i] = dp[i-1] * 2 % mod;
                }
                else {
                    dp[i] = dp[i-1] * 3 % mod;
                }
            }
        }
    }

    put(dp[n-1]);
}
signed main(){ Main();return 0;}

Measured memory_bytes: 3584
def main():
    n, m = map(int, input().split())
    # マイナスの場合は leader であり、同時にサイズ(*-1)を保持する
    uf = [-1] * (n+1)

    def uf_leader(a):
        if uf[a]<0:
            return a
        uf[a] = uf_leader(uf[a])
        return uf[a]
    def uf_unite(a, b):
        ua, ub = uf_leader(a), uf_leader(b)
        if ua==ub:
            return False
        if uf[ua] > uf[ub]:
            ua, ub = ub, ua
        uf[ua] += uf[ub]
        uf[ub] = ua
        return True
    def uf_leaders():
        return [v for v in range(1,n+1) if uf[v]<0]

    # print(uf[1:])
    for _ in range(m):
        a, b = map(int, input().split())
        uf_unite(a, b)
        # print(uf[1:])

    # print(uf_leaders())
    
    ans = len(uf_leaders())-1
    print(ans)

main()


Measured memory_bytes: 12908
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const int INF = 1000000005;
const int MAX = 105;

vector<int> to[MAX];
bool seen[MAX];
int d[MAX];

void bfs(int u) {
  queue<int> q;
  seen[u] = true;
  d[u] = 0;
  q.push(u);
  while (!q.empty()) {
    u = q.front();
    q.pop();
    for (int v: to[u]) {
      if (seen[v]) continue;
      d[v] = d[u] + 1;
      seen[v] = true;
      q.push(v);
    }
  }
}

int main() {
  int n, u, k, v;
  cin >> n;
  rep(i, n) {
    cin >> u >> k;
    rep(j, k) {
      cin >> v;
      to[u-1].push_back(v-1);
    }
  }

  rep(i, n) {
    seen[i] = false;
    d[i] = INF;
  }

  bfs(0);

  rep(i, n) {
    cout << i+1 << " ";
    if (seen[i]) cout << d[i] << endl;
    else cout << -1 << endl;
  }



  
  return 0;
}


Measured memory_bytes: 3140
while True:
    n, x = map(int, input().split())
    if n == x == 0:
        break
   
    result = 0
    for a in range(1, x // 3):
        for b in range(a + 1,  x // 2):
            c = x - a - b
            if b < c <= n:
                result += 1    
    print(result)

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

#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for (int i = (n); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

int main()
{
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;

    s[k - 1] = (char)(s[k - 1] - 'A' + 'a');
    OP(s);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <sstream>
using namespace std;

typedef long long LL;
#define lowbit(x) ((x)&(-x))
#define INF 0x3f3f3f3f
#define memset(a,b) memset(a,b,sizeof(a))
#define	GE() printf(">----------\n")
#define	IN() freopen("in.txt","r",stdin)
#define	OUT() freopen("out.txt","w",stdout)
const int mod=1000000007;
const int inf=0x3f3f3f3f;
const double pi=acos(-1.0);
const double eps=1e-8;
const int maxn=100005;

LL n, a, b;
LL data[maxn];


bool check(LL mid){
    LL sta=0;
    for(int i=0;i<n;i++){
        LL have=data[i]-mid*b;
        if(have>0){
            sta+=ceil(have*1.0/(a-b));
            if(sta>mid)return 0;
        }
    }
    return 1;
}


int main()
{
    while(~scanf("%lld%lld%lld", &n, &a, &b)){
        LL l=0, r=0;
        for(int i=0;i<n;i++){
            scanf("%d", &data[i]);
            r=max(r, data[i]);
        }
        while(l<r){
            int mid=(r+l)>>1;
            if(check(mid))r=mid;
            else l=mid+1;
        }
        printf("%d\n", l);
    }
    return 0;
}



Measured memory_bytes: 1024
def cal(x,y,o):
    x,y=int(x),int(y)
    if o=="+":
        return x+y
    if o=="-":
        return x-y
    if o=="*":
        return x*y
    if o=="/":
        return x/y

def RPN(shiki):#式のリスト
    stack=[]
    operator=["+","-","*","/"]
    for x in shiki:#数字をスタックに格納
        if x not in operator:
            stack.append(int(x))
        else:#演算子なら直前の２つの数字を演算してスタックに格納
            s=stack.pop()
            f=stack.pop()
            stack.append(cal(f,s,x))
    return stack[-1]

shiki=list(input().split())
print(RPN(shiki))




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

int main()
{
    int n,x,br=1,zb=0,g;
    cin >> n >> x;
    vector<int> v(n,0);
    for (int i=0;i<n;i++)
    {
        cin >> g;
        zb+=g;
        if(zb<=x)
            br++;
    }
    cout << br;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int n=a+b;
    int m=c+d;
    if (n>m) cout<<"Left"<<endl;
    else if(n==m) cout<<"Balanced"<<endl;
    else if (n<m)cout<<"Right"<<endl;
    return 0;
}

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

int main(){
     int n;
     cin >> n;
     int a,b,cntp,cntq;
     int i=1;
     vector<int> order(n);
     vector<int> P(n);
     vector<int> Q(n);
     for(int i=0;i<n;i++){
       cin >> P[i];
       order[i]=i+1;
     }
     for(int i=0;i<n;i++) cin >> Q[i];


    do {
      cntp =0;
      cntq =0;
      for(int i=0;i<n;i++){
        if(order[i]==P[i])  cntp++;
        if(order[i]==Q[i])  cntq++;
      }

        if(cntp ==n) a = i;
        if(cntq ==n) b = i;
    i++;

    } while(next_permutation(order.begin(),order.end()));

cout << abs(a-b) << endl;
}


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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main()
{
    string S;
    cin >> S;
    if((S[0] == S[1]) && (S[1] == S[2])){
      cout << "Yes" << endl;
    } else if((S[1] == S[2]) && (S[2] == S[3])){
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var A, B, C int
	fmt.Scan(&A, &B, &C)
	if A == B {
		fmt.Println(C)
	} else if A == C {
		fmt.Println(B)
	} else {
		fmt.Println(A)
	}

}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
inline int add(int a,int b)
{a+=b;return a>=MOD?a-MOD:a;}
inline int sub(int a,int b)
{a-=b;return a<0?a+MOD:a;}
inline int mul(int a,int b)
{return 1LL*a*b%MOD;}
int ksm(int a,int b)
{
    int ans=1;
    for(;b;b>>=1,a=mul(a,a))
        if(b&1)ans=mul(ans,a);
    return ans;
}
const int Q=5005;
int f[Q][Q],si[Q],rem[Q];
int las[Q],e[Q<<1],nn[Q<<1],inc=0;
void ins(int x,int y)
{
    e[++inc]=y;
    nn[inc]=las[x];
    las[x]=inc;
}
int fac[Q<<1],ifac[Q],g[Q];
void dfs(int x,int last)
{
    si[x]=1;
    f[x][1]=1;
    for(int t=las[x];t;t=nn[t]){
        int y=e[t];
        if(y==last)continue;
        dfs(y,x);
        fill(rem+1,rem+si[x]+si[y]+1,0);
        for(int i=1;i<=si[x];i++)
            for(int j=0;j<=si[y];j++)
                rem[i+j]=add(rem[i+j],mul(f[x][i],f[y][j]));
        for(int i=1;i<=si[x]+si[y];i++)
            f[x][i]=rem[i];
        si[x]+=si[y];
    }
    for(int i=2;i<=si[x];i+=2)
        f[x][0]=sub(f[x][0],mul(f[x][i],g[i>>1]));
}
int main()
{
    int n;
    scanf("%d",&n);
    fac[0]=1;
    for(int i=1;i<=(n<<1);i++)
        fac[i]=mul(fac[i-1],i);
    ifac[n]=ksm(fac[n],MOD-2);
    for(int i=n;i;--i)
        ifac[i-1]=mul(ifac[i],i);
    for(int pi=1,i=0;i<=n;i++,pi=mul(pi,(MOD+1)>>1))
        g[i]=mul(pi,mul(fac[i<<1],ifac[i]));
    for(int i=1,x,y;i<n;i++)
        scanf("%d%d",&x,&y),ins(x,y),ins(y,x);
    dfs(1,0);
    printf("%d\n",sub(0,f[1][0]));
    return 0;
}

Measured memory_bytes: 97280
s = input()
n = len(s)


MOD = 2019
dp = [0] * MOD
dp[0] += 1

rem = 0
base = 1
for i in range(n):
    d = int(s[n-i-1])
    rem = (rem + base * d) % MOD
    # print((i, d, rem))
    dp[rem] += 1
    base *= 10
    base %= MOD

ans = 0
for i in range(MOD):
    ans += (dp[i]*(dp[i]-1)) // 2
print(ans)


Measured memory_bytes: 9216
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <list>
#include <iomanip>
#include <queue>
#include <functional>
#include <cassert>
#include <cmath>
#include <set>
#include <map>

#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define NL << endl
using namespace std;
using ll = long long;
int INFINT = 1 << 30;
ll INFLL = 1LL << 60;
int gcd(int a, int b) {return b ? gcd(b, a%b) : a;}

int main() {

	int n;
	int ans = 0;
	vector<int> a(200001, 0);

	cin >> n;

	int k;

	cin >> k;

	REP(i, n) {
		int t;
		cin >> t;
		a[t]++;
	}

	sort(a.begin(), a.end(), greater<int>());

	for(int i = k; i < n; i++) {
		ans += a[i];
	}

	cout << ans NL;

	return 0;

}

Measured memory_bytes: 1024
#!/usr/bin/env python3
import sys


def main():
    A, V = map(int, input().split())
    B, W = map(int, input().split())
    T = int(input())
    if A < B:
        a = V * T + A
        b = W * T + B
        if a >= b:
            print('YES')
        else:
            print('NO')
    elif A > B:
        a = -(V * T) + A
        b = -(W * T) + B
        if a <= b:
            print('YES')
        else:
            print('NO')


if __name__ == '__main__':
    main()


Measured memory_bytes: 9136
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c,n,m;
    cin>>a>>b>>c>>n>>m;
    if(a+b<=2*c){
        cout<<a*n+b*m;
    }
    else{
        long kq;
        if(m>=n){
            kq=min(m*2*c,n*2*c+(m-n)*b);
            cout<<kq;
        }
        else{
            kq=min(n*2*c,m*2*c+(n-m)*a);
            cout<<kq;
        }
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	char rem[50];
	scanf("%s",rem);
	int val=1;
	if (rem[0]!='A'){
		val=0;
	}
	int found=0;
	for (int i=2;i<strlen(rem)-1;i++){
		if (rem[i]=='C'){
			found++;
		}
	}
	if (found!=1)val=0;
	for (int i=0;i<strlen(rem);i++){
		if (rem[i]!='A'&&rem[i]!='C'&&rem[i]>='A'&&rem[i]<='Z'){
			val=0;
		}
	}
	if (val)printf ("AC\n");
	else printf ("WA\n");
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<functional>
#include<map>
#include<unordered_set>
using namespace std;
//int p = 998244353;
int p = 1000000007;
#define int long long
#define vel vector<long long>
#define vvel vector<vel>
#define rep(i,n) for(int i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define qin pair<int,pin>
#define V vector
#define Endl endl
#define veb vector<bool>
#define rev(s) reverse(s.begin(),s.end())
int max_kai = 150000;
vel kai(max_kai, 1);
vel inv_kai;
int rui(int a, int n) {
	if (n == 0) { return 1; }
	int x = rui(a, n / 2);
	x *= x; x %= p;
	if (n % 2 == 1) { x *= a; x %= p; }
	return x;
}
int inv(int a) { return rui(a, p - 2); }
void make_kai() {
	for (int i = 1; i < max_kai; i++) { kai[i] = kai[i - 1] * i; kai[i] %= p; }
	inv_kai = kai;
	rep(i, max_kai) { inv_kai[i] = inv(kai[i]); }
}
int nCr(int n, int r) {
	int a = kai[n] * inv_kai[r]; a %= p;
	a *= inv_kai[n - r]; a %= p;
	return a;
}
int inf = 6000000000000;
vel dijk(vvel &way, vel &cost, int s) {
	int n = way.size(); int m = 7 * n;
	vel ans(m, inf);
	priority_queue<pin, vector<pin>, greater<pin>> que;//cost,pla
	que.push(mkp(0,s));
	while (!que.empty()) {
		pin x = que.top(); que.pop();
		int pla = x.second;
		if (ans[pla] == inf) {
			int sum_cost = x.first;
			ans[pla] = sum_cost;
			int nex_cost = sum_cost + cost[pla];
			int mod = nex_cost % 7;
			for (auto x : way[pla/7]) {
				que.push(mkp(nex_cost, x * 7 + mod));
			}
		}
	}
	return ans;
}
vel pa;
int root(int x) {
	if (pa[x] == -1) { return x; }
	int ans = root(pa[x]); pa[x] = ans;
	return ans;
}
void marge(int x, int y) {
	x = root(x);
	y = root(y);
	if (x != y) {pa[x] = y;}
}
#define lower(h,val) lower_bound(h.begin(),h.end(),val)-h.begin()
#define upper(h,val) upper_bound(h.begin(),h.end(),val)-h.begin()
int sol(int a, int b, int c, int d) {
	return abs(a*c - b * d);
}
signed main(){
	int n; cin >> n;
	V<double> a(n);
	rep(i, n) { cin >> a[i]; }
	sor(a);
	double ans=0;
	rep(i, n) {
		rep(j, i) {
			vel ex;
			for (int k = n-1; k >= n-4; k--) {
				if (k != i && k != j) {
					ex.push_back(k);
				}
			}
			mmax(ans, (a[ex[0]] + a[ex[1]]) / (a[i] - a[j]) );
		}
	}
	printf("%.6lf\n", ans);
	return 0;
}


Measured memory_bytes: 4304
#include <iostream>
#include <map>
#include <algorithm>
using namespace std;
int main(void){
    int n,m;
    cin>>n>>m;
    int a[n],b[n],c[m],d[m];
    for(int i=0;i<n;i++)cin>>a[i]>>b[i];
    for(int i=0;i<m;i++)cin>>c[i]>>d[i];
    
    
    for(int i=0;i<n;i++){
        long int min=5000000000000;
        int ans=0;
        for(int j=0;j<m;j++){
            int sum1;
            if(a[i]-c[j]>=0)sum1=a[i]-c[j];
            else sum1=-a[i]+c[j];
            int sum2;
            if(b[i]-d[j]>=0)sum2=b[i]-d[j];
            else sum2=-b[i]+d[j];
            int sum=sum1+sum2;
            if(min>sum){
                min=sum;
                ans=j+1;
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(int i = m, i##_len = (n); i < i##_len; ++i)
#define reprev(i, n) for(int i = (n-1LL); i >= 0; --i)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef pair <P,int> PP;
typedef long double ld;

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, c; cin >> n >> c;
    vector<PP> stc;
    vector<bitset<31> > end(100002);
    int imos[100002] = {};
    rep (i, n) {
        int p, q, r; cin >> p >> q >> r;
        stc.emplace_back(make_pair(p, q), r);
    }
    sort(all(stc), [](PP a, PP b){return a.first.second < b.first.second;});
    rep (i, n) {
        int q = stc[i].first.second, r = stc[i].second;
        end[q].set(r);
    }
    rep (i, n) {
        int p = stc[i].first.first, q = stc[i].first.second, r = stc[i].second;
        if (end[p][r]) imos[p + 1]++;
        else imos[p]++;
        imos[q + 1]--;
        eprintf("%d %d %d\n", end[p][r] * 1, p, q);
    }
    int ans = imos[0];
    repp (i, 1, 100002) {
        imos[i] += imos[i - 1]; 
        chmax(ans, imos[i]);
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3064
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	n := nextInt()

	ans := "No"
	for i := 1; i <= 9; i++ {
		for j := 1; j <= 9; j++ {
			if i*j == n {
				ans = "Yes"
			}
		}
	}

	fmt.Println(ans)
}


Measured memory_bytes: 640