akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.AbstractMap;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		solve(sc,out);

		out.flush();
	}

	public static void solve(FastScanner sc, PrintWriter out) {
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		out.println((a % 3 == 0 || b % 3 == 0 || (a+b)%3==0) ? "Possible" : "Impossible");
	}

	public static int gcd(int a, int b) {
		if(a < b) return gcd(b, a);
		if(b == 0) return a;
		return gcd(b, a % b);
	}

	public static long gcd(long a, long b) {
		if(a < b) return gcd(b, a);
		if(b == 0) return a;
		return gcd(b, a % b);
	}

	public static int lcm(int a, int b) {
		return (a * b) / gcd(a, b);
	}
}

class Pair<K, V> extends AbstractMap.SimpleEntry<K, V> {

    public Pair(final K key, final V value) {
        super(key, value);
    }

    public Pair<V, K> swap() {
    	return new Pair<V, K>(getValue(), getKey());
    }
 }

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        return tokenizer.nextToken("\n");
    }

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

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

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

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    }
}

Measured memory_bytes: 21204
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

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

int main() {
  ll N;

  cin >> N;

  string common;
  cin >> common;

  unordered_map<char, int> common_um;
  for (size_t i = 0; i < common.length(); i++) {
    common_um[common[i]]++;
  }

  for (int i = 1; i < N; i++) {
    string tmp;
    unordered_map<char, int> tmp_um;
    cin >> tmp;
    for (size_t i = 0; i < tmp.length(); i++) {
      tmp_um[tmp[i]]++;
    }
    for (auto& kv : common_um) {
      common_um[kv.first] = min(common_um[kv.first], tmp_um[kv.first]);
    }
  }

  string ans = "";
  for (auto& kv : common_um) {
    if (kv.second > 0) {
      for (int i = 0; i < kv.second; i++) ans += kv.first;
    }
  }

  sort(ans.begin(), ans.end());
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
let input = require("fs").readFileSync("/dev/stdin", "utf8")

function main({ input, load, yesno, math_sum, math_max, math_min, log_json }) {
    const [N] = load()
    const A = load(N,1,false).map(BigInt)

    if(A.includes(0n)) {
        console.log(0)
        return
    }

    let result = 1n
    for(const a of A) {
        result *= a
        if(result > 1e18) {
            console.log(-1)
            return
        }
    }
    
    console.log(result.toString())
}



let inputs = input.split(/[\s\n]/)
main({
    input,
    yesno: value => value ? 'Yes' : 'No',
    math_sum: numbers => numbers.reduce((acc, cur) => acc + cur, 0),
    load(rows = 1, cols = 1, is_number = true) {
        const length = rows * cols
        let result = inputs.splice(0, length)
        if(is_number) result = result.map(Number)
        if(cols > 1) {
            const arrays = new Array(cols)
            for(let col = 0; col < cols; col++) {
                arrays[col] = new Array()
                for(let row = 0; row < rows; row++) {
                    arrays[col].push(result[row * cols + col])
                }
            }
            result = arrays
        }
        return result
    },
    inifinite_loop_preventer() {
        throw new Error("Infinite loop")
    },
    math_max,
    math_min,
    log_json(value) {
        console.log(JSON.stringify(value))
    },
})


function math_max(numbers, initial_value = null) {
    let result = (initial_value === null) ? numbers[0] : initial_value
    for(const n of numbers) if(n > result) result = n
    return result
}

function math_min(numbers, initial_value = null) {
    let result = (initial_value === null) ? numbers[0] : initial_value
    for(const n of numbers) if(n < result) result = n
    return result
}


Measured memory_bytes: 46072
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn adder (i: usize, j: usize) -> isize{
    let mut pow: usize = 1;
    for k in 1..i {
        pow *= 10;
    }
    (pow * j) as isize
}

fn main(){
    input!{
        n: i64,
        m: i64
    }
    print!("{}", (n*(n-1)/2) + (m * (m-1))/2);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int gcd(int a, int b) {  
  return b != 0 ? gcd(b, a % b) : a;
}//MAX
int lcm(int a, int b) { 
   return a * b / gcd(a, b);
   }
//MIN

 main() {
string s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string t = "ABCDEFGH";
int a,b;
cin >> a >>b;
for(int i=0;i<a;i++){
    for(int j=0;j<b;j++){
        string t;
        cin >> t;
        if(t=="snuke"){
            cout << s.at(j);
            if(i<18)cout << i+1<<endl;
            else cout << t.at(i-18)<<endl;
        } 
    }
}
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner stdin = new Scanner(System.in);
        int n = stdin.nextInt();
        int k = stdin.nextInt();
        int ans = 0;
        for (int i = 0; i < n; i++) {
            int h = stdin.nextInt();
            if (k <= h) ans++;
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 47848
import sys
input = sys.stdin.readline
def main():
    K, S = map(int, input().split())
    CNT = 0
    for x in range(K+1):
        for y in range(K+1):
            if S - x -y >= 0 and S - x -y <= K:
                CNT += 1
    print(CNT)            

if __name__ == '__main__':
    main()

Measured memory_bytes: 8864
import java.util.Scanner;
public class Main {
	static Scanner scan=new Scanner(System.in);
	static int gcd (int a, int b) {return b>0?gcd(b,a%b):a;}
	static long lcm (int a, int b) {return a*b/gcd(a,b);}
	static int max(int a,int b) {return a>b?a:b;}
	static int min(int a,int b) {return a<b?a:b;}
	static long factorial(int i) {return i==1?1:i*factorial(i-1);}
	static int lower_bound(int a[],int key) {
		int low=0,high=a.length;
		while(low<high) {
			int mid=((high-low)/2)+low;
			if(a[mid]<=key)low=mid+1;
			else high=mid;
		}
		return high;
		}
	static int upper_bound(int a[],int key) {
		int low=0,high=a.length;
		while(low<high) {
			int mid=((high-low)/2)+low;
			if(a[mid]<key)low=mid+1;
			else high=mid;
		}
		return high;
		}
	static boolean isPrime (int n) {
		if (n==2) return true;
		if (n<2 || n%2==0) return false;
		double d = Math.sqrt(n);
		for (int i=3; i<=d; i+=2)if(n%i==0){return false;}
		return true;
	}
	static int upper_division(int a,int b) {
		if(a%b==0) {
			return a/b;
		}
		else {
			return a/b+1;
		}
	}
	static long lupper_division(long a,long b) {
		if(a%b==0) {
			return a/b;
		}
		else {
			return a/b+1;
		}
	}
	static long lmax(long a,long b) {return Math.max(a, b);}
	static long lmin(long a,long b) {return Math.min(a, b);}
	static int[] setArray(int a) {
		int b[]=new int[a];
		for(int i=0;i<a;i++) {
			b[i]=scan.nextInt();
		}
		return b;
	}
	static String reverce(String str) {
		String strr="";
		for(int i=str.length()-1;i>=0;i--) {
			strr+=str.charAt(i);
		}
		return strr;
	}
	public static void main(String[] args) {
		int a=scan.nextInt();
		long sum=0;
		for(int i=0;i<a;i++) {
			sum+=scan.nextLong()-1;
		}
		System.out.println(sum);
	}
}

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

template<typename ... Ts> void read(Ts& ...vs){(std::cin >> ... >> vs);}

int main()
{
    std::size_t K;
    read(K);
    std::string S;
    read(S);

    if(S.size() <= K)
    {
        std::cout << S << std::endl;
    }
    else
    {
        std::string A(S.begin(), S.begin() + K);
        A += "...";
        std::cout << A << std::endl;
    }
    return 0;
}


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

#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) begin(x), end(x)
#define uniq(x) (x).erase(unique(all(x)), end(x))
#define bit(n) (1LL << (n))
#define cdiv(a, b) (((a) - 1) / (b) + 1)
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr long double PI = 3.1415926535897932384626433832795028L;
constexpr int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

int N;
int A[220000];
int dp_jun[220000][2], dp_gyak[220000][2];
signed main() {
    cin >> N;
    rep(i, N) { cin >> A[i]; }
    for (int i = 0; i < N; i += 2) {
        dp_jun[i + 2][0] = dp_jun[i][0] + A[i];
        dp_jun[i + 2][1] = dp_jun[i][0] + A[i + 1];
        chmax(dp_jun[i + 2][1], dp_jun[i][1] + A[i + 1]);
    }
    for (int i = N - 1; i >= 0; i -= 2) {
        dp_gyak[i - 2][0] = dp_gyak[i][0] + A[i];
        dp_gyak[i - 2][1] = dp_gyak[i][0] + A[i - 1];
        chmax(dp_gyak[i - 2][1], dp_gyak[i][1] + A[i - 1]);
    }

    if (N % 2 == 0) {
        fin(max(dp_jun[N][0], dp_jun[N][1]));
    }

    int ans = LLONG_MIN;
    for (int i = 0; i < N; i += 2) {
        chmax(ans, max(dp_jun[i][0], dp_jun[i][1]) + max(dp_gyak[i][0], dp_gyak[i][1]));
    }
    cout << ans << endl;

}

Measured memory_bytes: 11420
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <map>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define INF ((int)1e9)
#define INFLL ((ll)1e18)
#define MOD (1000000007LL)


int main(int argc, const char * argv[]) {
    ll X, Y;
    cin >> X >> Y;
    ll K = Y/X;
    int Res = 1;
    while (K > 1) {
        ++Res;
        K /= 2;
    }
    cout << Res << endl;
    return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define VVVI vector<vector<vector<ll>>>
#define VVVVI vector<vector<vector<vector<ll>>>>
#define REP(i,n) for(ll i=0,_n=(n);(i)<(ll)_n;++i)
#define REPR(i,n) for(ll i=(ll)(n)-1;0<=(i);--i)
#define RANGE(i,a,b) for(ll i=(ll)a,_b=(ll)(b);(i)<_b;++i)
#define RANGER(i,a,b) for(ll i=(ll)(b)-1,_a=(ll)(a);(_a)<=i;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
#define FI first
#define SE second
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template<typename T>void maxUpdate(T& a, T b) {a = max(a, b);}
template<typename T>void minUpdate(T& a, T b) {a = min(a, b);}

#define MOD 1000000007LL
#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll A,B;
	while(cin>>A>>B) {
		string a, b;
		REP(i, B) a += to_string(A);
		REP(i, A) b += to_string(B);
		
		cout<<min(a, b)<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void) {
    int n,h,w;
    int count;

    cin >> n;  cin >> h;  cin >> w;
    for(int i=0; i<n; i++) {
        int a,b;
        cin >> a; cin >> b;
        if( h <= a && w <= b ) {
            count++;
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 256
#pragma region
#ifndef LOCAL_DEBUG
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#endif

#include <assert.h>
#include <math.h>

#include <algorithm>
#include <iomanip>
#include <iostream>
#include <set>
#include <vector>
#define pb push_back
#define f(i, a, b) for (int i = a; i < b; i++)
#define revf(i, b, a) for (int i = b; i >= a; i--)
#define all(v) v.begin(), v.end()
#define srt(v) sort(v.begin(), v.end())
#define revsrt(v) sort(v.rbegin(), v.rend())
#define sp << ' ' <<
#define en << '\n'
#define precision(x) cout << fixed << setprecision(x);
#define fio                \
  ios::sync_with_stdio(0); \
  cin.tie(0);              \
  cout.tie(0);

using namespace std;

template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &v) {
  os << "{" << v.first << ", " << v.second << "}" en;
  return os;
}

template <typename T>
ostream &operator<<(ostream &os, set<T> &v) {
  for (T t : v) os << t << " ";
  os en;
  return os;
}

template <typename T>
ostream &operator<<(ostream &os, vector<T> &v) {
  for (T t : v) os << t << " ";
  os en;
  return os;
}

template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
  int n = v.size();
  for (int i = 0; i < n; i++) is >> v[i];
  return is;
}

#define int long long
#define pii pair<int, int>
#define float long double
#define vi vector<int>
#define vvi vector<vi>
#define vpii vector<pii>
#define vvpii vector<vpii>
#pragma endregion

int mod = 1e9 + 7;  // 998244353;
const int MAX = 1e5 + 5;

void preprocessing() {}

int diff(string s, string t) {
  int count = 0;
  assert(s.size() == t.size());
  f(i, 0, s.size()) { count += s[i] != t[i]; }
  return count;
}

void solvetestcase() {
  string s, t;
  cin >> s >> t;
  int ans = diff(s.substr(0, t.size()), t);
  f(i, 0, s.size() - t.size() + 1) {
    ans = min(ans, diff(s.substr(i, t.size()), t));
  }
  cout << ans en;
}

#undef int
int main() {
  fio;
  preprocessing();

  int t = 1;
  // UNCOMMENT FOR TESTCASES	\
	cin >> t;

  f(T, 1, t + 1) {
    // UNCOMMENT FOR CODEJAM,HACKERCUP	\
		cout << "Case #" << T << ": ";
    solvetestcase();
    cout.flush();
  }

  return 0;
};

/*
    AUTHOR:     KUNAL TAWATIA
    EDUCATION:  INDIAN INSTITUTE OF TECHNOLOGY, JODHPUR
*/


Measured memory_bytes: 3572
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1001001001
#define LINF 1001001001001001001
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LLP;

int main() {

    int N;
    cin >> N;
    vector<int> A(N);
    rep(i,N) cin >> A[i];
    sort(A.begin(), A.end(), greater<int>());

    ll ans = 0;
    rep(i,N) {
        if (i == 0) continue;
        ans += A[i / 2];
    }

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

Measured memory_bytes: 4048
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007; // 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
/*-------------------------------------------------*/
int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int n, w; cin >> n >> w;
  long long pivot;
  vector<vector<long long> > mono(4);
  REP(i, n) {
    int w, v; cin >> w >> v;
    if (i == 0) pivot = w;
    mono[w - pivot].emplace_back(v);
  }
  REP(i, 4) {
    sort(ALL(mono[i]), greater<long long>());
    FOR(j, 1, mono[i].size()) mono[i][j] += mono[i][j - 1];
    mono[i].insert(mono[i].begin(), 0);
  }
  long long ans = 0;
  REP(i, mono[0].size()) REP(j, mono[1].size()) REP(k, mono[2].size()) REP(l, mono[3].size()) {
    long long weight = pivot * (i + j + k + l) + 1 * j + 2 * k + 3 * l;
    if (weight <= w) {
      long long value = mono[0][i] + mono[1][j] + mono[2][k] + mono[3][l];
      ans = max(ans, value);
    }
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
use proconio::*;
use proconio::marker::*;

struct State {
    elem: Vec<usize>,
    memo: Vec<usize>,
    cnt: usize,
}

impl State {
    fn init(&mut self) {
        self.elem.iter_mut().for_each(|e| *e = 0);
        self.memo.clear();
        self.cnt = 0;
    }
    fn insert(&mut self, x: usize) {
        let q = x / 64;
        let r = x % 64;
        let e = &mut self.elem[q];
        if *e >> r & 1 == 0 {
            *e |= 1 << r;
            self.cnt += 1;
            self.memo.push(x);
        }
    }
    fn snap(&mut self) {
        self.memo.clear();
    }
    fn rollback(&mut self) {
        self.cnt -= self.memo.len();
        for &x in self.memo.iter() {
            self.elem[x / 64] ^= 1 << (x % 64);
        }
        self.memo.clear();
    }
    fn answer(&self) -> usize {
        self.cnt
    }
}

#[fastout]
fn run() {
    input! {
        n: usize,
        q: usize,
        c: [Usize1; n],
        ask: [(Usize1, usize); q],
    }
    let batch = (n as f64 / (q as f64).sqrt()).ceil() as usize;
    let mut ans = vec![0; q];
    let mut query = vec![vec![]; n / batch + 1];
    let mut state = State {
        elem: vec![0; n / 64 + 1],
        memo: vec![],
        cnt: 0,
    };
    for (i, (l, r)) in ask.into_iter().enumerate() {
        if r - l <= batch {
            for &c in c[l..r].iter() {
                state.insert(c);
            }
            ans[i] = state.answer();
            state.rollback();
        } else {
            query[l / batch].push((r, l, i));
        }
    }
    for (i, mut query) in query.into_iter().enumerate() {
        query.sort_unstable_by_key(|p| p.0);
        let mid = (i + 1) * batch;
        let mut t = mid;
        state.init();
        for (r, l, k) in query {
            for &c in c[t..r].iter() {
                state.insert(c);
            }
            t = r;
            state.snap();
            for &c in c[l..mid].iter() {
                state.insert(c);
            }
            ans[k] = state.answer();
            state.rollback();
        }
    }
    for a in ans {
        println!("{}", a);
    }
}

fn main() {
    run();
}


Measured memory_bytes: 44700
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int main()
{
	int n;
	string s, t;
	cin >> n;
	cin >> s >> t;
	string ans="";
	int a = 0;
	int b = 0;
	for (int i = 0; i < 2*n; i++) {
		if (i % 2 != 0) {
			ans += t[a];
			a++;
		}
		else {
			ans += s[b];
			b++;
		}
	}
	cout << ans << endl;
	
}

Measured memory_bytes: 256
M, D = list(map(int, input().split()))

cnt = 0
for iM in range(1, M+1):
    for iD in range(1, D+1):
        d1 = iD % 10
        d10 = iD // 10
        if d1 == 1 or d10 == 1:
            continue
        if d1 * d10 == iM:
            cnt += 1
print(cnt)


Measured memory_bytes: 2940
from math import gcd
import numpy as np
from numba import njit

n = int(input())
a = list(map(int, input().split()))
MAX = 10 ** 6

g = a[0]
for e in a:
    g = gcd(g, e)

if g != 1:
    print("not coprime")
    exit()

nums = np.zeros(MAX + 1, np.int64)
for e in a:
    nums[e] += 1


@njit
def f(nums):
    for i in range(2, MAX + 1):
        if nums[i::i].sum() > 1:
            return False

    return True


bl = f(nums)

if bl:
    print("pairwise coprime")
else:
    print("setwise coprime")



Measured memory_bytes: 208832
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define rep(i, n) for(ll i = 0;i < n;i++)
template<class T, class U> void cmax(T& a, U b) { if (a<b) a = b; }
template<class T, class U> void cmin(T& a, U b) { if (a>b) a = b; }

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

  ll n;
  ll k;
  cin >> n >> k;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];

  ll X = 0;
  ll ans = 0;

  for (ll i = 60; i >= 0; i--) {
    ll cnt = 0;
    rep(j, n) {
      if ((1LL<<i) & a[j]) cnt++;
    }

    // 1
    if (cnt < n-cnt && (X | (1LL<<i)) <= k) {
      ans += (1LL << i) * (n-cnt);
      X |= (1LL << i);
    // X を0
    } else {
      ans += (1LL << i) * cnt;
    }
  }

  cout << ans << endl;
}


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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)

#define P pair<lli,lli>

signed main(){

	lli n,y;
	cin>>n>>y;

	for(lli a=n;a>=0;a--){
		if(DEBUG)cout<<"a="<<a<<endl;
		for(lli b=n-a;b>=0;b--){
			if(DEBUG)cout<<"b="<<b<<endl;
			lli left = y-10000*a-5000*b;
			if(left<0)continue;
			if(left%1000!=0)continue;
			lli c = left/1000;
			if(a+b+c!=n)continue;
			cout<<a<<" "<<b<<" "<<c<<endl;
			return 0;
		}
	}

	cout<<"-1 -1 -1"<<endl;

	return 0;
}

Measured memory_bytes: 256
s = list(input())
t = list(input())
s.sort()
t.sort(reverse = True)
new_s = ''.join(s)
new_t = ''.join(t)
lis = [new_s, new_t]
lis.sort()
if lis[0] == new_s and lis[1] != new_s:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
def main():
    L = input()
    n = len(L)
    t = []
    mod = 10 ** 9 + 7
    for i, v in enumerate(L):
        if v == '1':
            t.append(i)
    r = 1
    p = 1
    for i, v in enumerate(reversed(L)):
        p %= mod
        if v == '1':
            r *= 2
            r += p
            r %= mod
        p *= 3
    print(r % mod)
main()


Measured memory_bytes: 45680
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long int n,m,i,j,k,o,p;
    vector<long long int>uos;

    scanf("%lld",&n);
    for(i=0; i<n; i++)
    {
        scanf("%lld",&m);
        uos.push_back(m);
    }
    sort(uos.begin(),uos.end());
    for(i=0,k=0; i<n-1; i++)
    {
        for(j=i+1; j<n; j++)
        {
            for(o=j+1; o<n; o++)
            {
                if(uos[i]+uos[j]>uos[o])
                {
                    k++;
                }
            }

        }
    }
    printf("%lld\n",k);
    uos.clear();




    return 0;
}


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

int main()
{
	int W, H, N;
	cin >> W >> H >> N;
	int x[N], y[N], a[N];
	for(int i = 0; i < N; i++){
		cin >> x[i] >> y[i] >> a[i];
	}
	bool painted_x[W + 1];
	bool painted_y[H + 1];
	for(int i = 0; i < W + 1; i++){
		painted_x[i] = false;
	}
	for(int i = 0; i < H + 1; i++){
		painted_y[i] = false;
	}
	for(int i = 0; i < N; i++){
		switch (a[i]){
			case 1:
			{
				for(int j = 0; j < x[i]; j++){
					painted_x[j] = true;
				}
			}
			break;
			case 2:
			{
				for(int j = x[i] + 1; j < W + 1; j++){
					painted_x[j] = true;
				}
			}
			break;
			case 3:
			{
				for(int j = 0; j < y[i]; j++){
					painted_y[j] = true;
				}
			}
			break;
			case 4:
			{
				for(int j = y[i] + 1; j < H + 1; j++){
					painted_y[j] = true;
				}
			}
			break;
		}
	}
	int from_x = 0;
	int to_x = W;
	for(int i = 1; i < W + 1; i++){
		if(!painted_x[i] && painted_x[i - 1]){
			from_x = i;
		}
		if(painted_x[i] && !painted_x[i - 1]){
			to_x = i - 1;
		}
	}
	int from_y = 0;
	int to_y = H;
	for(int i = 1; i < H + 1; i++){
		if(!painted_y[i] && painted_y[i - 1]){
			from_y = i;
		}
		if(painted_y[i] && !painted_y[i - 1]){
			to_y = i - 1;
		}
	}
	bool x_all_painted = false;
	for(int i = 0; i < W + 1; i++){
		if(!painted_x[i]) break;
		if(i == W) x_all_painted = true;
	}
	bool y_all_painted = false;
	for(int i = 0; i < H + 1; i++){
		if(!painted_y[i]) break;
		if(i == H) y_all_painted = true;
	}
	if(x_all_painted || y_all_painted){
		cout << 0 << endl;
	}else{
		cout << (to_x - from_x) * (to_y - from_y) << endl;
	}
	return 0;
}

Measured memory_bytes: 256
/* ex4_2
  key_tree */

#include <stdio.h>
#include <math.h>

int main(void){
    // 入力
    int length_A, length_B, time, minute;
    scanf("%d %d %d %d",&length_A, &length_B, &time, &minute);

    double time_angle, minute_angle, angle, ans;
    // 時針と分針の角度をラジアンで求める
    time_angle = 2 * M_PI* ((time + minute / 60.0)/12);
    minute_angle = 2 * M_PI * minute / 60.0;
    // 針同士のなす角度
    angle = fabs(minute_angle - time_angle);
    //　余弦定理
    ans = sqrt(pow(length_A, 2) + pow(length_B, 2) 
          - 2 * length_A *length_B * cos(angle));
    
    // 小数点以下10桁を表示
    printf("%.10lf\n", ans);

    return 0;

}


Measured memory_bytes: 2648
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define ll long long
#define mp make_pair
#define pii pair<int,int>
#define mod 1000000007
#define M 1000000
using namespace std;

void solve(){
    
    ll n,m,k;
    cin>>k>>n>>m;

    for (int i = n; i <= m; ++i)
    {
        if(i%k==0){
            cout<<"OK";
            return;
        }
    }
    cout<<"NG";

}

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

    long t;
    // cin>>t;
    t=1;
    while(t--)
    {
    solve();
    }
}


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

int main() {
  int N, A, Ans;
  Ans = 30;
  cin >> N;
  for (int i=0; i<N; i++){
    cin >> A;
    for (int j=1; j<50; j++){
      int k = pow(2, j);
      if(A % k != 0 && j-1 < Ans){
        Ans = j-1;
      }
    }
  }
  cout << Ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define eb emplace_back
#define precision(n) cout << fixed << setprecision(n);
#define fast {ios_base::sync_with_stdio(false);cin.tie(NULL);}
int main()
{
    fast;
 double n,p,w,l,v;
 cin>>l;
 p=l/3.0;
 cout<<setprecision(12)<<fixed<<p*p*p<<endl;;
    return 0;
}




Measured memory_bytes: 256
N = gets.to_i
S = []
T = []
W = []

N.times do
  w = gets.chomp
  r = 0; l = 0; 
  (0 ... w.size).each do |i|
    c = w[i]
    if c == '('
      l += 1
    elsif l > 0
      l -= 1
    else
      r += 1
    end
  end
  if l.zero? # terminate
    T << [r, l]
  elsif r.zero?
    S << [r, l] # start
  else
    W << [r, l]
  end
end

l_sum = S.inject(0){|s,(r,l)| s + l }

W.sort_by!{|r,l| r - l }
W.each do |(r,l)|
  if l_sum >= r
    l_sum = l_sum - r + l
  else
    puts 'No' 
    exit
  end
end

T.each do |(r,l)|
  if l_sum >= r
    l_sum = l_sum - r + l
  else
    puts 'No' 
    exit
  end
end

puts l_sum.zero? ? 'Yes' : 'No'


Measured memory_bytes: 73580
#include<bits/stdc++.h>
#define faster  ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define ull unsigned long long
#define pb push_back
const double PI = acos(-1.0);
using namespace std;

int main()
{
    faster

    int n;
    string s,t;

    cin>>n>>s>>t;

    for(int i=0; i<n; i++)
    {
        cout<<s[i]<<t[i];
    }
    cout<<endl;




    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
const int MOD=1e9+7;
const double pi=acos(-1);


int main(){
  int d,n;
  cin >> d >> n;
  if(d==0){
    if(n!=100)cout<<n<<endl;
    else cout<<101<<endl;
  }
  if(d==1){
    int cnt=0;
    for(int i=100;i<=500000;i+=100){
      if(i%100==0 && i%10000!=0){
        cnt++;
      }
      if(cnt==n){
        cout<<i<<endl;
        return 0;
      }
    }
  }
  if(d==2){
    int cnt=0;
    for(ll i=10000;i<=1e9;i+=10000){
      if(i%10000==0 && i%1000000!=0){
        cnt++;
      }
      if(cnt==n){
        cout<<i<<endl;
        return 0;
      }
    }
  }
  
  
}


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

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
        cin >> a[i];
    int mx = *max_element(a.begin(), a.end());
    int mn = *min_element(a.begin(), a.end());
    cout << mx - mn << endl;
    return 0;
}

Measured memory_bytes: 3600
#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 n, m, x;
  cin >> n >> m >> x;
  vector<int> a(m);
  rep(i, m) cin >> a[i];

  vector<int> toll(n+1, 0);
  rep(i, m) toll[a[i]] = 1;

  int cost1 = 0;
  rep(i, x) cost1 += toll[i];

  int cost2 = 0;
  for (int i = x; i < n; ++i) cost2 += toll[i];

  int min_cost = min(cost1, cost2);
  cout << min_cost << endl;
  return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

const int N = (int)3e5+3;

ll mpow(ll a, ll b){
	if(b==0) return 1;
	else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
	else return mpow(a,b-1) * a % MOD;
}
ll gcd(ll a, ll b){
	if(b==0) return a;
	else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
	if(kaijo_memo.size() > n) return kaijo_memo[n];
	if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
	while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
	return kaijo_memo[n];
}
ll nCr(ll n, ll r){
	if(n < r || r < 0) return 0;
	ll ret = 1;
	ret *= kaijo(n); ret %= MOD;
	ret *= mpow(kaijo(r), MOD-2); ret %= MOD;
	ret *= mpow(kaijo(n-r), MOD-2); ret %= MOD;
	return ret;
}

int main(void){
	int n;cin>>n;int a;vector<int> A;
	rep(i,n){
		cin>>a;
		A.push_back(a);
	}
	sort(all(A));
	cout<<A[A.size()-1]-A[0]<<endl;

	return 0;
}


Measured memory_bytes: 256
import java.awt.*;
import java.awt.geom.*;
import java.io.*;
 
import java.util.*;
class Main {
 
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double r = sc.nextDouble();
 
        System.out.printf("%.6f %.6f",r*r*Math.PI,2 * Math.PI*r);
    }
}


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

int main() 
{
    int n;
    cin >> n;
    map<string, int> mp;
    rep(i,n) {
        string s;
        cin >> s;
        sort(s.begin(), s.end());
        mp[s]++;
    }

    ll ans = 0;
    for(auto p : mp) {
        ll x = p.second;
        ans += x*(x-1)/2;
    }

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


Measured memory_bytes: 11136
#include<bits/stdc++.h>
#define rep(i,n) for (int i=0; i<n; i++)
#define REP(i,x,n) for (int i=x; i<n; i++)
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;

int main(){
  string s;
  cin >> s;
  deque<char> d;
  d.push_back('S');
  int q;
  cin >> q;
  bool flag = true;
  rep(i,q){
    int ti;
    cin >> ti;
    // cout << "ti " << ti << endl;
    if (ti == 1){
      flag = flag? false : true;
    }
    else {
      int fi;
      char ci;
      cin >> fi >> ci;
      // cout << "fi " << fi << endl;
      // cout << "ci " << ci << endl;
      // cout << "flag " << flag << endl;
      if (flag){
        if (fi == 1) d.push_front(ci);
        else d.push_back(ci);
      }
      else {
        if (fi == 1 ) d.push_back(ci);
        else d.push_front(ci);

      }
    }
    // for(auto c : d) cout << c;
    // cout << endl;
    // cout << endl;
  }
  while (!d.empty()){
    if (flag){
      char c = d.front();
      if (c == 'S'){
        cout << s;
        d.pop_front();
        continue;
      }
      cout << c;
      d.pop_front();
    }
    else {
      char c = d.back();
      if (c == 'S'){
        reverse(s.begin(), s.end());
        cout << s;
        d.pop_back();
        continue;
      }
      cout << c;
      d.pop_back();
    }
  }
  cout << endl;
  return 0;
}

// int main(){
//   string s;
//   cin >> s;
//   int q;
//   cin >> q;
//   string t;
//   rep(i,q){
//     int ti;
//     cin >> ti;
//     if (ti == 1){
//       swap(s, t);
//     }
//     else {
//       int fi;
//       char ci;
//       cin >> fi >> ci;
//       if (fi == 1) t += ci;
//       else s += ci;
//     }
//   }
//   reverse(t.begin(), t.end());
//   t += s;
//   cout << t << endl;
//   return 0;
// }


Measured memory_bytes: 3948
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <sstream>
#include <istream>

using namespace std;

typedef pair<int,int> P;
typedef long long ll;

int main(){
	string S;
	cin >> S;
	int N = S.size(), MOD = 1000000007;

	ll dp[100001][4] = {};
	for(int i=N; i>=0; i--){
		for(int j=3; j>=0; j--){
			if(i==N){
				dp[i][j] = (j==3 ? 1 : 0);
			}else{
				dp[i][j] = dp[i+1][j] * (S[i]=='?' ? 3LL : 1LL);
				if(j<3 && (S[i]=='?'||S[i]=="ABC"[j])){
					dp[i][j] += dp[i+1][j+1];
				}
				dp[i][j] %= MOD;
			}
		}
	}
	cout << dp[0][0] << endl;
	
	return 0;
}

Measured memory_bytes: 3584
X, Y, A, B, C = map(int, input().split())
p = list(map(int, input().split()))
q= list(map(int, input().split()))
r= list(map(int, input().split()))
p.sort(reverse = True)
q.sort(reverse = True)
r.sort(reverse = True)
ls = []
for i in range(X):
    ls.append(p[i])
for i in range(Y):
    ls.append(q[i])
ls.extend(r)
ls.sort(reverse = True)
print(sum(ls[:X+Y]))

Measured memory_bytes: 114412
a, b, c, x, y = map(int,input().split())
 
if x == y:
    ans = min(a * x + b * y, c * x * 2)
elif x > y:
    ans = min(a * x + b * y, c * x * 2, c * y * 2 + a *(x-y))
else:
    ans = min(a * x + b * y, c * y * 2, c * x * 2 + b *(y-x))
 
print(ans)

Measured memory_bytes: 3060
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;
const long long INF=1e9+5;
const string alp="abcdefghijklmnopqrstuvwxyg"; //26
const string ALP="ABCDEFGHIJKLMNOPQRSTUVWXYG";
typedef long long ll;

int main() {
  string s;
  cin>>s;
  vector<char> vec;
  for(int i=0;i<s.size();i++){
    if(s[i]=='0'){
      vec.push_back('0');
    }
    else if(s[i]=='1'){
      vec.push_back('1');
    }
    else{
      if(!vec.empty()){
        vec.pop_back();
      }
    }
  }
  string ans;
  for(int i=0;i<vec.size();i++){
    ans+=vec.at(i);
  }
  cout<<ans<<endl;
      
}

Measured memory_bytes: 3604
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() {
  for i := 1; ; i++ {
    data := nextInt()
    if data == 0 {
      break
    }
    fmt.Printf("Case %d: %d\n", i, data)
  }
}


Measured memory_bytes: 1308
n=int(input())
l=[]
for i in range(n):
    l.append(input())
    
a=l.count('AC')
b=l.count('WA')
c=l.count('TLE')
d=l.count('RE')

print('AC x',a)
print('WA x',b)
print('TLE x',c)
print('RE x',d)

Measured memory_bytes: 16296
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<cmath>
#include<queue>
#include<stack>
#include<list>

#define endl "\n"
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;

int euc(int x,int y){
    if(y == 0) return x;
    else return euc(y,x%y);
}

int main(){
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++) cin>>a[i];

    int ans = a[0];
    for(int i=1;i<n;i++){
        ans = euc(ans,a[i]);
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
 
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
using namespace std;
 
int main() {
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    int totalVote = 0;
    rep(i, n) {
        cin >> a[i];
        totalVote += a[i];
    }
 
    int cnt = 0;
    rep(i, n) {
        if (a[i] * 4 * m >= totalVote) cnt++;
    }
 
    cout << (cnt >= m ? "Yes" : "No") << endl;
    return 0;
}


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

int main(){
    int n, k;
    vector<int> a;
    
    cin >> n >> k;
    a.resize(n);
    for(int i = 0;i < n;++i){
        cin >> a[i];
    }
    
    int s = 1,l = k, ans = 1;
    
    while(l < n){
        s = l;
        l = s + k - 1;
        ans++;
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf  1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)

const long long mod[] = {999999937LL, 1000000007LL}, base = 9973;

map<VI,int> mp;

void Rev(int l,int r,vector<int> &v){
	for(int i=0;i<=10;i++){
		if(l+i>=r-i)break;
		swap(v[l+i],v[r-i]);
	}
	return;
}

void bfs(vector<int> v,int depth){
	if(depth>=4)return;
	for(int i=0;i<v.size();i++){
		for(int j=i+1;j<v.size();j++){
			vector<int>v1;
			v1 = v;
			Rev(i,j,v1);
			if(mp[v1]!=0){
				if(mp[v1]>depth){
					mp[v1] = depth;
					bfs(v1,depth+1);
				}
			}else if(mp[v1]==0){
				mp[v1] = depth;
				bfs(v1,depth+1);
			}
		}
	}
	return;
}

void bfs2(vector<int> v,int depth,int &ans){
	if(depth>=4)return;
	for(int i=0;i<v.size();i++){
		for(int j=i+1;j<v.size();j++){
			vector<int>v1;
			v1 = v;
			Rev(i,j,v1);
			if(mp[v1]!=0){
				ans = min(ans,mp[v1]+depth);
				bfs2(v1,depth+1,ans);
			}else if(mp[v1]==0){
				bfs2(v1,depth+1,ans);
			}
		}
	}
	return;
}



int main(){
	int n;
	cin >>n;
	VI a(n);
	rep(i,n)cin>>a[i];
	mp[a]=0;
	bfs(a,1);
	VI b(n);
	rep(i,n)b[i]=i+1;
	if(a==b){
		cout << 0 << endl;
		return 0;
	}
	int ans = 10000;
	if(mp[b]!=0){
		ans = mp[b];
	}
	bfs2(b,1,ans);
	if(ans==10000){
		cout << n-1 << endl;
	}else{
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 9664
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); ++i)
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
const ll INF = 1LL << 60;

int main(){
	int n; cin >> n;
	for(int i = 0 ; i < n; ++i){
		string s;
		cin >> s;
		if(s == "Y") {
			cout << "Four" << endl;
			return 0;
		}
	}
	cout << "Three" << endl;
	
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  // ABC084B - Postal Code
  int A, B; cin >> A >> B;
  string S; cin >> S;
  bool flag = true;
  if(S.size() != A+B+1){
    cout << "No" << endl;
    return 0;
  }
  REP(i, A){
    if(S[i] < '0' || S[i] > '9') flag = false;
  }
  if(S[A] != '-') flag = false;
  for(int i = A+1; i < A+B+1; i++){
    if(S[i] < '0' || S[i] > '9') flag = false;
  }

  if(flag){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#pragma region template
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
//*
constexpr ll MOD = 1e9 + 7;
/*/
constexpr ll MOD = 998244353;
//*/
constexpr ll INF = 1e+18;
constexpr ld EPS = 1e-12L;
constexpr ld PI = 3.14159265358979323846L;
constexpr ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
constexpr ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
inline bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
inline bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  ll h, w;
  cin >> h >> w;
  vs a(h);
  rep(i, h){
    cin >> a[i];
  }
  vs r = a, b = a;
  rep(i, w){
    r[0][i] = '#';
    b[h-1][i] = '#';
  }
  repr(i, 1, h-1){
    rep(j, w){
      if(j%2){
        r[i][j] = '#';
      }else{
        b[i][j] = '#';
      }
    }
  }
  rep(i, h) print(r[i]);
  print();
  rep(i, h) print(b[i]);
}


Measured memory_bytes: 1536
import sys

def sa(Type= int):
  return [Type(x) for x in input().split()]

def solve(s):
  print(sum([int(x) for x in s]))

if __name__ == '__main__':
  # sys.stdin = open('input.txt', 'r')

  while True:
    s = input()
    if s == '0':
      break

    solve(s)


Measured memory_bytes: 5612
from itertools import combinations
N = int(input())
L = [int(i) for i in input().split()]

ans = 0
for a, b, c in combinations(L, 3):
    if a != b and b != c and c != a and a + b > c and b + c > a and c + a > b:
        ans += 1
print(ans)

Measured memory_bytes: 9072