akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
const int MM = 1000000000;
const int MOD = MM + 7;
const int MAX = 510000;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmin(T& a, T b) {if(a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if(a < b) {a = b; return true;} return false;}
const ll INF = 1LL << 60;

vector<ll> divisor(ll n) {
  vector<ll> ret;
  for(ll i=1; i*i<=n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i*i != n) ret.push_back(n / i);
    }
  }
  sort(all(ret));
  return (ret);
}

int main() {
    int a, b, k; cin >> a >> b >> k;
    int num = 0;
    for(int i=100; i>0; i--) {
        if(a % i == 0 && b % i == 0) num++;
        if(num == k) {
            cout << i << endl;
            return 0;
        }
    }
}

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

#define gcu getchar_unlocked
#define pcu putchar_unlocked
#define _il inline
#define _in _il int in
#define _sc _il bool scan
_in(int c){int n=0;bool m=false;if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;} //&&c<='9'
_in() {return in(gcu());}
_sc(int &n){int c=gcu();return c==EOF?false:(n=in(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
//_sc(string &s){int c;s="";
//	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
template <typename H,typename... T> _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _vo _il void out
#define _vl _il void outl
template <typename T>
_vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
_vo(const char *s){while(*s)pcu(*s++);}
_vo(char c){pcu(c);}
//_vo(string &s){for (char c: s) pcu(c);}
template <typename H,typename... T> _vo(H&& h, T&&... t){out(h);out(move(t)...);}
//template <typename T> _vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);out('\n');}
_vl(){out('\n');}
template <typename... T> _vl(T&&... t){out(move(t)...);outl();}

int main() {
	auto p = [](int a) {printf("%02d:%02d:%02d\n", a / 3600, a / 60 % 60, a % 60);};
	for (int t, h, s; t = in(), h = in(), s = in(), ~t || ~h || ~s;) {
		int a = 3600 * 2 - (t * 3600 + h * 60 + s);
		p(a);
		p(a * 3);
	}
}


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int h, n, i, j, sum = 0, p = 0;
    scanf("%lld", &h);
    i = log2 (h);
    i++;
    sum = pow(2, i) - 1;
    printf("%lld", sum);
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define INF 1000000000

int n;
int g[100][100];
int d[100],p[100];

void dijkstra(int start){
  d[start]=0;
  int mn,t,cnt=0;
  while(cnt<=n){
    mn=INF;
    for(int i=0;i<n;i++){
      if(p[i]==0 && mn>d[i]){
	mn=d[i];
	t=i;
      }
    }
    for(int i=0;i<n;i++){
      d[i]=min(g[t][i]+d[t],d[i]);
    }
    p[t]=1;
    cnt++;
  }
}


    
int main(){
  int u,k,v,c;
  for(int i=0;i<100;i++){
    p[i]=0;
    d[i]=INF;
    for(int j=0;j<100;j++){
      if(i==j) g[i][j]=0;
      else g[i][j]=INF;
    }
  }
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>u>>k;
    for(int j=0;j<k;j++){
      cin>>v>>c;
      g[u][v]=c;
    }
  }
  dijkstra(0);
  for(int i=0;i<n;i++){
    cout<<i<<" "<<d[i]<<endl;
  }
  return 0;
}
  



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

int main() {
  int N;
  cin >> N ;
  int div =100000000;
  int fx=0;
  int dig=0;
  int NN=0;
  
  for (int i=0;i<9;i++){
    dig = N/div;
    if(dig!=0){
    N = N - dig * div;
    }
    else{
    N=N;
    }
        NN += div*dig;

	div = div /10;
    fx += dig;
  }
  

  if (NN%fx==0){
  cout << "Yes" <<endl;
  }
  
  else {
    cout << "No" <<endl;

  }
}

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

int main()
{
    std::ios_base::sync_with_stdio (false);
    int n,k;
    cin>>n>>k;
    vector<ll>v(n);
    vector<ll>dp(n);
    for(int i=0;i<n;i++){
        cin>>v[i];
    }
    dp[0]=0;
    for(int i=1;i<n;i++){
        dp[i]=dp[i-1]+(ll)abs(v[i]-v[i-1]);
        for(int j=2;j<=k;j++){
            if(i-j<0){break;}
            dp[i]=min(dp[i],dp[i-j]+abs(v[i]-v[i-j]));
        }
    }
    cout<<dp[n-1];
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
//typedef vector<unsigned int>vec;
typedef vector<ll>vec;
typedef vector<vec> mat;
typedef vector<vector<int>> Graph;

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
//const ll MOD = 998244353;
const double PI = acos(-1.0);
const double EPS = 1e-10;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

vector<vector<int> > calcNext(const string &S) {
    int n = (int)S.size();
    vector<vector<int> > res(n+1, vector<int>(10, n));
    for (int i = n-1; i >= 0; --i) {
        for (int j = 0; j < 10; ++j) res[i][j] = res[i+1][j];
        res[i][S[i]-'0'] = i;
    }
    return res;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    string S;
    cin >> N >> S;
    vector<vector<int>> next = calcNext(S);
    vector<vector<ll>> dp(N+1, vector<ll>(4));
    dp[0][0] = 1;
    for (int i = 0; i < N; ++i) {
        for(int k = 0;k <= 2; k++){
            for (int j = 0; j < 10; ++j) {
                if (next[i][j] >= N) continue;
                add(dp[next[i][j] + 1][k+1], dp[i][k]);
            }
        }
    }
    ll res = 0;
    REP(i, N+1){
        add(res, dp[i][3]);
        //cout << dp[i][3] << endl;
    }
    cout << res << endl;
    
}


Measured memory_bytes: 4480
#include <iostream>
#include <string>

int main()
{
	std::string S;
	long long K;

	std::cin >> S >> K;

	// 1以外の文字は、N^5000兆文字増える
	// -> Sを左から見ていって、初めて出てきた1以外の文字が、K番目の文字
	char ans;
	int i;
	for ( i = 0; i < S.length(); i++ )
	{
		if ( S[i] != '1' )
		{
			ans = S[i];
			break;
		}
	}

	// ただし、Kがiより小さい場合は1になる
	if ( K <= i )
	{
		std::cout << "1" << std::endl;
	}
	else
	{
		std::cout << ans << std::endl;
	}

	return ( 0 );
}


Measured memory_bytes: 256
#include<stdio.h>
int main() {
    int a, b, c, x, cnt=0;
    scanf("%d %d %d %d", &a, &b, &c, &x);
    for(int i=0;i<=a;i++) {
        for(int j=0;j<=b;j++) {
            for(int k=0;k<=c;k++) {
                int t=i*500+j*100+k*50;
                if(t==x) cnt++;
                //if(t>=k) break;
            }
        }
    }
    printf("%d", cnt);
}

Measured memory_bytes: 128
n,m = gets.chomp.split(' ').map(&:to_i)
heights = gets.chomp.split(' ').map(&:to_i)
ans = [*(1..n)]
subtract = []
m.times do
    a,b = gets.chomp.split(' ').map(&:to_i)
    if (heights[a-1] < heights[b-1])
        subtract << a
    elsif (heights[a-1] > heights[b-1])
        subtract << b
    elsif heights[a-1] == heights[b-1]
        subtract << a
        subtract << b
    end
end
ans -= subtract
puts ans.size

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

int main() {
  int n;
  cin >> n;
  string s, t;
  cin >> s >> t;
  string ans;
  rep(i,n){
    ans += s[i];
    ans += t[i];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
int main(){
	int n;
	string s;
	cin >>n >> s;
	vector<int> w(n,0),b(n,0);
	rep(i,n-1){
		b[i+1]=b[i];
		if (s[i]=='#')
			b[i+1]++;
	}
	for (int i=n;i>=1;--i){
		w[i-1]=w[i];
		if (s[i]=='.')
			w[i-1]++;
	}
	int ans=10000000;
	rep(i,n){
		ans = min(ans,(b[i]+w[i]));
	}
	cout <<ans <<endl;
}

Measured memory_bytes: 2180
use std::io::{self, Read};
use std::f64;

macro_rules! input {
    ($it: expr) => ($it.next().unwrap().parse().unwrap());
    ($it: expr, $T: ty) => ($it.next().unwrap().parse::<$T>().unwrap());
}

fn main() {
    let mut buf = String::new();
    io::stdin().read_to_string(&mut buf).unwrap();

    let mut it = buf.split_whitespace();

    let a: f64 = input!(it);
    let b: f64 = input!(it);
    let h: f64 = input!(it);
    let m: f64 = input!(it);

    let pi2 = (-1f64).acos() * 2.0;

    let alpha = pi2 * (h * 60.0 + m) / (12.0 * 60.0);
    let beta = pi2 * m / 60.0;

    let x1 = a * alpha.cos();
    let y1 = a * alpha.sin();

    let x2 = b * beta.cos();
    let y2 = b * beta.sin();

    let ans = ((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)).sqrt();

    println!("{}", ans);
}

Measured memory_bytes: 2880
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  int ans = 0;

  cin >> N;

  vector<tuple<string,int,int>> a;

  for (int i = 1; i <= N; ++i) {
    string S;
    int P;
    
    cin >> S >> P;
    P = -P;
    a.push_back(tie(S,P,i));
  }
  sort(a.begin(),a.end());
  
  for (int i = 0; i <= N-1; ++i) {
    cout << get<2>(a[i]) << endl;
  }
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new Main().run();
	}
	
	void run() {
		Scanner scan = new Scanner(System.in);
		int[] inputArray = new int[10];
		int[] outputArray = new int[3];
		// input
		for(int i = 0; i < 10; i++) inputArray[i] = scan.nextInt();
		// search
		for (int i = 0; i < 3; i++) {
			int max = 0;
			int max_j = 0;
			for (int j = 0; j < 10; j++) {
				int tmp = inputArray[j];
				if(max < tmp) {
					max = tmp;
					max_j = j;
				}
			}
			outputArray[i] = max;
			inputArray[max_j] = 0;
		}
		// output
		for (int i = 0; i < 3; i++) {
			System.out.println(outputArray[i]);
		}
	}
}


Measured memory_bytes: 26364
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int uint;
int main() {
	char s[233];
	scanf("%s",s);
	for(int i=0;i<strlen(s);i++)putchar(s[i]=='1'?'9':'1');
}

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

using namespace std;

typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = (ll)1e9 + 7;

int main()
{
  int H, W, D; scanf("%d %d %d", &H, &W, &D);
  vector<int> X(H * W + 5, -1), Y(H * W + 5, -1);
  int a;
  for (int i = 0; i < H; ++i) {
    for (int j = 0; j < W; ++j) {
      scanf("%d", &a);
      Y[a] = i;
      X[a] = j;
    }
  }
  vector<int> S(H * W + 5, 0);
  for (int i = 1; i <= D; ++i) {
    for (int j = i + D; j <= H * W; j += D) {
      S[j] = abs(X[j] - X[j - D]) + abs(Y[j] - Y[j - D]);
      S[j] += S[j - D];
    }
  }

  int Q; scanf("%d", &Q);
  while (Q-- > 0) {
    int l, r; scanf("%d %d", &l, &r);
    int ans = S[r] - S[l];
    printf("%d\n", ans);
  }
  return 0;
}


Measured memory_bytes: 2176
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

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

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (let _ = write!(out,$($format)*););
    }
    input! {
        n: usize, p: i64,
        s: chars,
    }
    let s: Vec<i64> = s.into_iter().map(|c| (c as u8 - b'0') as _).collect();
    let mut dp = vec![0i64; n + 1];
    let mut pw = vec![0i64; n + 1];
    pw[0] = 1;
    for i in 0..n {
        pw[i + 1] = pw[i] * 10 % p;
    }
    let mut tot: i64 = 0;
    if p == 2 || p == 5 {
        for i in 0..n {
            if s[i] % p == 0 {
                tot += i as i64 + 1;
            }
        }
        puts!("{}\n", tot);
        return;
    }
    let mut hm = HashMap::new();
    hm.insert(0, 1);
    for i in (0..n).rev() {
        dp[i] = (dp[i + 1] + pw[n - i - 1] * s[i]) % p;
        *hm.entry(dp[i]).or_insert(0) += 1;
        tot += hm[&dp[i]] - 1;
    }
    puts!("{}\n", tot);
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


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

int main() {
int n;
  string b;
  double a,g;
  cin >> n;
  for(int i=0; i<n; i++){
    cin >> a >> b; 
  if(b=="JPY"){
    g+=a;
  } else {
    g+=a*380000;
  }
  }
  cout <<g <<endl;
}


Measured memory_bytes: 256
a,b = gets.split.map &:to_i

if a > 0
  # どっちも正
    puts "Positive"
else
  # a が負
  if a < 0
    # どっちも負
    if b < 0
      if (b-a) % 2 == 0
        puts "Negative"
      else
        puts "Positive"
      end
    else
      # 正と負
      puts "Zero"
    end
  else
    # zero
    puts "Zero"
  end
end

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

using namespace std;
#define int long long
#define sim template <class c
#define ris return *this
#define dor > debug &operator<<
#define eni(x)                                                                    \
    sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<(c i) \
    {
sim>
struct rge {
    c b, e;
};

sim> rge<c> range(c i, c j) { return rge<c>{i, j}; }

sim> auto dud(c *x) -> decltype(cerr << *x, 0);

sim> char dud(...);

struct debug {
#ifndef LOCAL

    ~debug() {
        cerr << endl;
    }

    eni(!=) cerr << boolalpha << i;
        ris;
    }

    eni(==) ris << range(begin(i), end(i));
    }

    sim, class b dor(pair<b, c> d) {
        ris << "(" << d.first << ", " << d.second << ")";
    }

    sim dor(rge<c> d) {
        *this << "[";
        for (auto it = d.b; it != d.e; ++it)
            *this << ", " + 2 * (it == d.b) << *it;
        ris << "]";
    }

#else
    sim dor(const c &)
    {
        ris;
    }
#endif
};

#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define int long long

void solve();

int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int t = 1;
//    cin >> t;
    for (int i = 1; i <= t; ++i) {
        solve();
    }
    return 0;
}

const int mxn = 1e6 + 10;
int n;
int spf[mxn];

void solve() {
    for (int i = 0; i < mxn; ++i) {
        spf[i] = i;
    }
    for (int i = 2; i < mxn; ++i) {
        if (spf[i] == i) {
            for (int j = i * i; j < mxn; j += i) {
                spf[j] = i;
            }
        }
    }
    int n;
    cin >> n;
    vector<int> v(n);
    set<int> s;
    int f = 0, g = 0;
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
        int t = v[i];
        g = __gcd(g, v[i]);
        while (t > 1) {
            int k = spf[t];
            if (s.count(k) == 1) {
                f = 1;
            }
            s.insert(k);
            while (t % k == 0) t /= k;
        }
    }
    if (f == 0) {
        cout << "pairwise coprime\n";
        return;
    }
    if (g == 1) {
        cout << "setwise coprime\n";
    } else {
        cout << "not coprime\n";
    }
}

Measured memory_bytes: 22388
import Data.List

main = do
    getLine
    as <- map read . words <$> getLine :: IO [Integer]
    let z = 0 `elem` as
    print $ if z then 0 else f 1 as

f s [] = s
f s (a:as) | s*a >10^18 = -1
           | otherwise = f (s*a) as 

Measured memory_bytes: 64164
//https://algo-logic.info/brute-force-dfs/#toc_id_3

#include <bits/stdc++.h>
#include <vector>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(j, m) for (int j = 0; j <= (int)(m); j++)

ll n;

int dfs(string &s)
{
    ll ret = 0;
    vector<char> lis = {'3', '5', '7'};
    if (s.size() > 0)
    {
        if (stoll(s) > n)
        {
            return ret;
        }
        else
        {
            bool ok = true;
            for (auto c : lis)
            {
                if (s.find(c) == string::npos)
                {
                    ok = false;
                }
            }
            if (ok)
            {
                ret++;
            }
        }
    }
    for (auto c : lis)
    {
        s.push_back(c);
        ret += dfs(s);
        s.pop_back();
    }
    return ret;
}

int main(){
    cin>>n;
    string s="";
    cout<<dfs(s)<<endl;
}

Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		int[] count= new int[4];
		while(cin.hasNext()){
			String str = cin.next();
			String[] a = str.split(",");
			if(a[1].equals("A")){
				count[0]++;
			}
			else if(a[1].equals("B")){
				count[1]++;
			}
			else if(a[1].equals("AB")){
				count[2]++;
			}
			else{
				count[3]++;
			}
		}
		for(int i = 0; i < 4;i++){
			System.out.println(count[i]);
		}
	}

}

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

using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define reps(i, m, n) for (int i = m; i <= n; ++i)

using i64 = long long;
using pii = pair<i64, i64>;

template<class A, class B>inline bool chmax(A &a, const B &b){return b > a ? a = b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b < a ? a = b,1 : 0;}

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

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

  int n;
  cin >> n;

  cout << "ABC" << n << "\n";

  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define out(str) cout << str << endl

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; }

int A,B;

int main(){
    cin >> A >> B;
    if(A <=8 && B <=8){
        out("Yay!");
    }else{
        out(":(");
    }
    return 0;
}

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

#include <iostream>
#include <vector>
// #include <map>
// #include <string>
#include <algorithm>
// #include <numeric>
// #include <limits>

using std::cout;
using std::cin;
using std::endl;
using std::vector;

short w;
short d;
vector<short> ws(10);
vector<short> ds(10);

inline void input() {
	ws.resize(w);
	for (int i = 0; i < w; i++) {
		cin >> ws[i];
	}
	std::sort(begin(ws), end(ws));
	ds.resize(d);
	for (int i = 0; i < d; i++) {
		cin >> ds[i];
	}
	std::sort(begin(ds), end(ds));
}

void solve() {
	input();
	int cost = 0;
	short wkey = 0;;
	short dkey = 0;;
	for (; wkey < w and dkey < d;) {
		if (ws[wkey] == ds[dkey]) {
			cost += ws[wkey];
			wkey++;
			dkey++;
			continue;
		}
		if (ws[wkey] < ds[dkey]) {
			cost += ws[wkey];
			wkey++;
			continue;
		} else { // ws[wkey] > ds[dkey]
			cost += ds[dkey];
			dkey++;
			continue;
		}
	}
	for (; wkey < w; wkey++) {
		cost += ws[wkey];
	}
	for (; dkey < d; dkey++) {
		cost += ds[dkey];
	}
	cout << cost << endl;
}

int main() {

	while (true) {
		cin >> w >> d;
		if (w == 0 and d == 0) {
			break;
		}
		solve();
	}

	//std::cout << "\e[38;5;0m\e[48;5;40m --- end ---  \e[m" << std::endl; // debug
	return 0;
}

Measured memory_bytes: 2928
MOD = 1000000007


def mod_pow(a, n, mod):
    """
    二分累乗法による a^n (mod m)の実装

    :param a: 累乗の底
    :param n: 累乗の指数
    :param mod: 法
    :return: a^n (mod m)
    """

    result = 1
    a_n = a
    while n > 0:
        if n & 1:
            result = result * a_n % mod
        a_n = a_n * a_n % mod
        n >>= 1
    return result


def mod_inverse(a, mod):
    """
    フェルマーの小定理による a^-1 ≡ 1 (mod m)の実装
    aの逆元を計算する

    a^-1 ≡ 1 (mod m)
    a * a^-2 ≡ 1 (mod m)
    a^-2 ≡ a^-1 (mod m)

    :param a: 逆元を計算したい数
    :param mod: 法
    :return: a^-1 ≡ 1 (mod m)
    """

    return mod_pow(a=a, n=mod - 2, mod=mod)


class ModCombination:
    """
    nCk (mod m)を扱うクラス
    """

    def __init__(self, mod, n_max):
        """
        イニシャライザ
        予め 1~nの階乗と階乗の逆元を計算しておく

        :param mod: 法
        :param n_max: nの最大値(100,000で約1秒)
        """
        self.mod = mod
        self.n_max = n_max
        self.facts = [1, 1]
        self.inverses = [None, 1]
        self.fact_inverses = [1, 1]

        for i in range(2, self.n_max + 1):
            self.facts.append(self.facts[i - 1] * i % self.mod)
            # self.inverses.append(mod_inverse(i, self.mod))
            self.inverses.append(self.mod - self.inverses[self.mod % i] * (
                        self.mod // i) % self.mod)
            self.fact_inverses.append(
                self.fact_inverses[i - 1] * self.inverses[i] % self.mod
            )

    def mod_combination(self, n, k):
        """
        nCk (mod m)を計算する

        :param n: n
        :param k: k
        :return: nCk (mod m)
        """
        if not 0 < k < n:
            raise ValueError

        denominator = \
            self.fact_inverses[k] * self.fact_inverses[n - k] % self.mod
        return self.facts[n] * denominator % self.mod


def calc_routes(combination, dx, dy):
    if dx == 0 or dy == 0:
        return 1
    else:
        return combination.mod_combination(dx + dy, dx)


def check(h, w, a, b):
    combination = ModCombination(mod=MOD, n_max=h + w)
    p = (b + 1, h - a)
    all_routes = 0
    while p[0] <= w and p[1] > 0:
        d1 = (p[0] - 1, p[1] - 1)
        d2 = (w - p[0], h - p[1])
        r1 = calc_routes(combination, *d1)
        r2 = calc_routes(combination, *d2)
        routes = r1 * r2 % MOD
        all_routes += routes
        all_routes %= MOD
        p = (p[0] + 1, p[1] - 1)
    return all_routes


def main():
    h, w, a, b = map(int, input().split())
    print(check(h, w, a, b))


if __name__ == '__main__':
    main()


Measured memory_bytes: 27148
#include <bits/stdc++.h>
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Weverything"
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/irange.hpp>
#pragma clang diagnostic pop

using namespace std;

int main() {
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  int n;
  std::cin >> n;
  std::array<std::pair<int, int>, 100000> odds;
  std::array<std::pair<int, int>, 100000> evens;
  for (int i = 0; i < 100000; i++) {
    odds[i].first = i;
    evens[i].first = i;
  }
  for (int i = 0; i < n; i++) {
    int v;
    std::cin >> v;
    if ((i % 2) != 0) {
      odds[v].second++;
    } else {
      evens[v].second++;
    }
  }
  std::sort(odds.rbegin(), odds.rend(), [](const auto& lhs, const auto& rhs) {
    return lhs.second < rhs.second;
  });
  std::sort(evens.rbegin(), evens.rend(), [](const auto& lhs, const auto& rhs) {
    return lhs.second < rhs.second;
  });
  if (odds[1].second == 0 && evens[1].second == 0) {
    if (odds[0].first == evens[0].first) {
      std::cout << n / 2 << std::endl;
    } else {
      std::cout << 0 << std::endl;
    }
    return 0;
  }
  if (odds[0].first != evens[0].first) {
    std::cout << (n - odds.front().second - evens.front().second) << std::endl;
    return 0;
  }
  if (odds[0].second + evens[1].second > odds[1].second + evens[0].second) {
    std::cout << (n - odds[0].second - evens[1].second) << std::endl;
  } else {
    std::cout << (n - odds[1].second - evens[0].second) << std::endl;
  }

  return 0;
}


Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.Linq;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = ReadArrayInt();
            var N = input[0];
            var K = input[1];
            var a = ReadArrayInt();
            var aSum = new long[N + 1];
            for (int i = 0; i < N; i++) aSum[i + 1] = aSum[i] + a[i];
            var Be = new List<long>();
            for (int i = 1; i <= N; i++) for (int j = i; j <= N; j++) Be.Add(aSum[j] - aSum[i - 1]);
            Be = Be.OrderByDescending(l => l).ToList();
            for (long i = (1L << 62); i != 0; i >>= 1)
            {
                var rem = new List<long>();
                var cnt = 0;
                foreach(var j in Be)
                {
                    if ((i & j) == i)
                    {
                        rem.Add(j);
                        cnt++;
                    }
                }
                if (cnt >= K)
                {
                    Be = rem;
                }
            }
            var ans = long.MaxValue;
            foreach (var l in Be) ans &= l;

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

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}

Measured memory_bytes: 37500
'use strict';
(function(input){
  input=input.trim().split(/\n+/);
  input=input.map(str=>str.split(/\s+/).map(x=>x-0));
  const N=input[0][0];
  if(N===1){
    console.log(1);
    return;
  }
  const delta=[];
  for(let m=1;m<=N;m++){
    for(let n=1;n<=N;n++){
      if(m===n){continue;}
      delta.push([input[n][0]-input[m][0],input[n][1]-input[m][1]]);
    }
  }
  var costCut=1;
  while(delta.length>0){
    var c=1;
    var d=delta.pop();
    var p=d[0],q=d[1];
    if(p===0&&q===0){
      continue;
    }
    for(let i=0,I=delta.length;i<I;i++){
      if(delta[i][0]===p&&delta[i][1]===q){
        c++;
        delta[i]=[0,0];
      }
    }
    if(c>costCut)costCut=c;
  }
  console.log(N-costCut);
})(require('fs').readFileSync('/dev/stdin','utf8'));


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

static const int MAX_NUM = 500001;

void MaxUp(int elem[], int num, int target)
{
    int left, right;
    int largest = target;

    left  = target * 2;
    right = left + 1;

    if (right <= num) {
        if (elem[largest] < elem[right]) {
            largest = right;
        }
        if (elem[largest] < elem[left]) {
            largest = left;
        }
    }
    else {
        if (left <= num) {
            if (elem[largest] < elem[left]) {
                largest = left;
            }
        }
    }

    if (largest != target) {
        swap(elem[target], elem[largest]);
        MaxUp(elem, num, largest);
    }

    return;
}

void MakeHeap(int elem[], int num)
{
    int i;

    for (i = num / 2; i >= 1; i--) {
        MaxUp(elem, num, i);
    }

    return;
}

int main(void)
{
    int i;
    int num;
    int elem[MAX_NUM];

    scanf("%d", &num);
    for (i = 1; i <= num; i++) {
        scanf("%d", &elem[i]);
    }

    MakeHeap(elem, num);

    for (i = 1; i <= num; i++) {
        printf(" %d", elem[i]);
    }
    printf("\n");

    return 0;
}

Measured memory_bytes: 3144
#include <stdio.h>

int main(int argc, char *argv[])
{
    int values[10000] = {};
    int count = 0;
    for (int x; scanf("%d", &x) == 1 && x;)
    {
        values[count++] = x;
    }
    for (int i = 0; i < count; ++i)
    {
        printf("Case %d: %d\n", i + 1, values[i]);
    }
    return 0;
}



Measured memory_bytes: 2072
#include <iostream>
#include <fstream>
#include <string> 
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <functional>

using namespace std;
using ll = long long;

#define FOR(i, m, n) for(int i = (m);i < (n);i++)
#define REP(i,n) for(int i = 0; i < int(n); i++)
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VL vector<ll>
#define VVL vector<vector<ll>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define PAIR pair<int,int>
#define MP make_pair
#define VP vector<pair<int,int>>
#define VS vector<string>
#define QUE queue<int>
#define DEQ deque<int>
#define PQUE priority_queue<int> //5,5,4,3,3,2,...
#define REPQUE priority_queue<int, vector<int>, greater<int>> //1,1,2,3,4,4,5,...
#define SUM(obj) accumulate((obj).begin(), (obj).end(), 0)
#define SORT(obj) sort((obj).begin(), (obj).end()) // 1,2,3,4,5...
#define RESORT(obj) sort((obj).begin(), (obj).end(), greater<int>()) // 5,4,3,2,1...
#define UB(obj,n) upper_bound((obj).begin(), (obj).end(), n) //itr > n
#define LB(obj,n) lower_bound((obj).begin(), (obj).end(), n) //itr>= n

const ll MOD = (ll)1e9 + 7;

int main() {
	ll X, Y;
	cin >> X >> Y;
	if (X % Y == 0) {
		cout << -1 << endl;
		return 0;
	}
	else {
		cout << X << endl;
		return 0;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main()
{
    int H, W;
    cin >> H >> W;
    vector<vector<char>> S(H, vector<char>(W, '-'));
    rep(i, H) rep(j, W) cin >> S.at(i).at(j);
    const int dx[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
    const int dy[8] = {-1, -1, -1, 0, 0, 1, 1, 1};
    rep(i,H){
        for (int j = 0; j < W;j++){
            if(S.at(i).at(j)=='#')
                continue;
            int count = 0;
            for (int k = 0; k < 8;k++){
                int x = i + dx[k];
                int y = j + dy[k];
                if(x<0||H<=x)
                    continue;
                if(y<0||W<=y)
                    continue;
                if (S.at(x).at(y) == '#')
                    count++;
            }
            S.at(i).at(j) = char(count+'0');
        }
    }
    for (int i = 0; i < H;i++){
        for (int j = 0; j < W;j++){
            cout << S.at(i).at(j);
        }
        cout << endl;
    }
}

Measured memory_bytes: 256
'use strict'

function Main(input) {
    let temp = input.trim().split(' ').map((v)=>parseInt(v));
    let a = temp.shift();
    let b = temp.shift();
    let t = temp.shift();

    let ans = Math.floor((t+0.5) / a)*b;

    console.log(ans);

}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#include<stdio.h>
int main()
{   int i,j,a[100],c,ave,N;
    float b,sum;
    sum=0;
    c=0;
    scanf("%d",&N);
    for(i=0;i<N;i++)
    { scanf("%d",&a[i]);
      sum=sum+a[i];
    }
    ave=sum/N;
    b=sum/N;
    if(b-ave>0.5)
      ave=ave+1;
    for(i=0;i<N;i++)
    {  c=c+(a[i]-ave)*(a[i]-ave);
	}
	printf("%d\n",c);
	return 0;
}

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

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

int MOD=1e9+7;
ll INF=1e18;

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

int n;
int match[410];
bool used[410];
vector<vector<int>> g(410);

bool dfs(int v){
    used[v]=true;
    for(int i=0; i<g[v].size(); i++){
        int u=g[v][i], w=match[u];

        if(w < 0 || (!used[w] && dfs(w))){
            match[v]=u;
            match[u]=v;
            return true;
        }
    }
    return false;
}

int bipartite_matching(){
    int res=0;
    memset(match, -1, sizeof(match));

    for(int v=0; v<n; v++){
        if(match[v] < 0){
            memset(used, false, sizeof(used));
            if(dfs(v)){
                res++;
            }
        }
    }
    return res;
}

int main(){
    cin>>n;
    vector<int> a(n), b(n), c(n), d(n);
    for(int i=0; i<n; i++) cin>>a[i]>>b[i];
    for(int i=0; i<n; i++) cin>>c[i]>>d[i];

    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            if(a[i]<c[j] && b[i]<d[j]){
                g[i].emplace_back(j+200);
                g[j+200].emplace_back(i);
            }
        }
    }

    cout << bipartite_matching() << endl;
}

Measured memory_bytes: 256
n, K = map(int, input().split())
point = []
x_list = []
y_list = []
for _ in range(n):
    x, y = map(int, input().split())
    point.append((x, y))
    x_list.append(x)
    y_list.append(y)
x_list.sort()
y_list.sort()

ans = 4 * (10 ** 18)
for i in range(len(x_list)):
    for j in range(i + 1, len(x_list)):
        for k in range(len(y_list)):
            for l in range(k + 1, len(y_list)):
                num = 0
                for x, y in point:
                    if (x_list[i] <= x <= x_list[j]) & (y_list[k] <= y <= y_list[l]):
                        num += 1
                if num >= K:
                    ans = min(ans, abs((x_list[j] - x_list[i]) * (y_list[l] - y_list[k])))
print(ans)

Measured memory_bytes: 75708
/*
このコード、と～おれ!
Be accepted!
  ∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

//保留所有权利。
#include<iostream>
#include<stdio.h>//printするよ
#include<vector>
#include<algorithm>//辞書順はnext_permutationだよ
#include<set>
#include<string>
#include<sstream>
#include<string.h>
#include<complex>
#include<time.h>
#include<random>
#include<cmath>
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<locale>
#include<utility>//swapで数値交換するよ
//END OF LIBRARIES.
#define rt "\n"//改行を最速化させるよ
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(s,n) rep(i,n)cin>>s[i];//vcin(配列名),(繰り返し回数)
#define sort(s) sort(s.begin(),s.end())
#define reve(s) reverse(s.begin(),s.end())
#define asas int ans=0
#define llcncn llint cnt=0
#define llasas llint ans=0
#define str string
#define please return
#define AC 0//おまじないだよ
#define Rapid cin.tie(0);ios::sync_with_stdio(false)
//END OF DEFINE.
using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
typedef vector<double> vdou;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<bool>> vvbool;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
//printf("%02d:%02d:%02d\n", h, m, s);・・・2文字は埋める・h、m、ｓ
//END OF TYPEDEF.

//最大公約数（GCD）を求めるよ
//最小公倍数（LCM）は＜＜　A × B ÷ GCD　 ＞＞で求まるよ

long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}
long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}
unsigned GetDigit(unsigned num) {
	return std::to_string(num).length();
}
int tow(int n) {//2のn乗を求めるらしい
	if (n == 0)return 1;
	int x = tow(n / 2);
	x *= x;
	if (n % 2 == 1)x *= 2;
	return x;
	//dominoに借りたやつです
}
/*
  for A以上B未満でI探索 for (int I = A; i <= B; i++)

  string s = to_string(i);　iをstringでsに変換

  char　小文字のほうが32大--------------------大文字と小文字の境=93

  大文字→小文字 文字列のn文字目を大文字で出力→ (char)toupper(a[n])

  int i = sqrt (n) で、ｎの平方根(9に対する3)をiに入れる

  pow(a,b) → aのb乗を求める

  s1.erase(n) 文字列s1の、n文字目以降削除
  */
int a=0, b=0, c = 0;
string s = "";

int main(void) {
	//vector,set,map,stack,queue,deque,priority_queue

	cin >> a;
	int ans = 0;
	if (a % 100 <= a / 100 * (105 - 100))ans++;
	sec(1, 0, ans == 1);

	please AC;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

import java.util.*;

public class Main {
    static int N;
    static int A;
    static int B;
    static int[] h;
    public static boolean isOK(long index) {
        long[] h_2 = new long[N];
        for (int i=0;i<N;i++) {
            h_2[i] = h[i];
            h_2[i] -= (long)B*index;
        }
        for (int i=0;i<N;i++) {
            if (h_2[i]>0) {
                index -= (h_2[i]+(A-B-1))/(A-B);
            }
        }
        if (index>=0) return true;
        else return false;
    }

    public static long binary_search() {
        long left = -1;
        long right = Integer.MAX_VALUE-100;

        while (right - left > 1) {
            long mid = left + (right - left) / 2;

            if (isOK(mid)) right = mid;
            else left = mid;
        }
        return right;
    }
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        N = in.nextInt();
        A = in.nextInt();
        B = in.nextInt();
        h = new int[N];
        for (int i=0;i<N;i++) {
            h[i] = in.nextInt();
        }

        out.println(binary_search());

        out.close();
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

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

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

    }
}


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

namespace ConsoleApp7
{
	class Program
	{
		static void Main(string[] args)
		{
			int n = int.Parse(Console.ReadLine());
			var x = Console.ReadLine().Split(' ');
			var y = Console.ReadLine().Split(' ');
			double p1 = 0;
			double p2 = 0;
			double p3 = 0;
			double p = 0;
			double pmax = 0;
			
			//P = 1
			for (int n_i = 0; n_i < n; n_i++)
			{
				double xi = double.Parse(x[n_i]);
				double yi = double.Parse(y[n_i]);

				p1 += Math.Abs(xi - yi);
			}

			//P = 2
			for (int n_i = 0; n_i < n; n_i++)
			{
				double xi = double.Parse(x[n_i]);
				double yi = double.Parse(y[n_i]);

				p2 += Math.Abs((xi - yi) * (xi - yi));

				if(n_i == n - 1)
				{
					p2 = Math.Sqrt(p2);
				}
			}

			//p = 3
			for (int n_i = 0; n_i < n; n_i++)
			{
				double xi = double.Parse(x[n_i]);
				double yi = double.Parse(y[n_i]);

				p3 += Math.Pow(Math.Abs(xi - yi), 3);
				
				if(n_i == n - 1)
				{
					p3 = Math.Pow(p3, (double)1/3);
				}
			}
			
			for (int n_i = 0; n_i < n; n_i++)
			{
				double xi = double.Parse(x[n_i]);
				double yi = double.Parse(y[n_i]);

				p = Math.Abs(xi - yi);

				if(pmax < p)
				{
					pmax = p;
				}
			}

			Console.WriteLine(p1);
			Console.WriteLine(p2);
			Console.WriteLine(p3);
			Console.WriteLine(pmax);

		}
	}
}



Measured memory_bytes: 17768
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  ll x;
  cin >> x;
  ll res = 0;
  ll now = 0;
  while(1){
    now++;
    if((now * 360) % x == 0){
      cout << now * 360 / x << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 3628
#include<iostream>
#include <climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define INF (int)1e9
using namespace std;
typedef long long ll;
typedef pair<int, int> P;



int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int N;
	cin >> N;
	vector<int> a(N);
	REP(i, N) cin >> a[i];
	int res = 0;
	REP(i, N) {
		while (a[i] % 2 == 0) {
			res++;
			a[i] /= 2;
		}
	}
	cout << res << "\n";

	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
#define ch() getchar()
#define pc(x) putchar(x)
template<typename T>inline void read(T&x){
	int f;char c;
	for(f=1,c=ch();c<'0'||c>'9';c=ch())if(c=='-')f=-f;
	for(x=0;c<='9'&&c>='0';c=ch())x=x*10+(c&15);x*=f;
}
template<typename T>inline void write(T x){
	static char q[64];int cnt=0;
	if(!x)pc('0');if(x<0)pc('-'),x=-x;
	while(x)q[cnt++]=x%10+'0',x/=10;
	while(cnt--)pc(q[cnt]);
}
const int maxm=20,maxs=(1<<16)+5,mod=1000000007;
int mo(const int x){
	return x>=mod?x-mod:x;
}
int fac[maxs],iac[maxs];
int binom(int n,int m){
	return n<0||m<0||m>n?0:1ll*iac[m]*iac[n-m]%mod*fac[n]%mod;
}
int A[maxm],f[maxs];
int main(){
	int N,M;
	read(N),read(M);
	for(int i=1;i<=M;++i)
		read(A[i]);
	int U=(1<<N)-1;
	iac[0]=iac[1]=1;
	for(int i=2;i<=U;++i)
		iac[i]=1ll*(mod-mod/i)*iac[mod%i]%mod;
	fac[0]=fac[1]=1;
	for(int i=2;i<=U;++i)
		fac[i]=1ll*fac[i-1]*i%mod,iac[i]=1ll*iac[i-1]*iac[i]%mod;
	f[0]=1;
	for(int i=M;i>=1;--i)
		for(int s=U;~s;--s)
			for(int s0=s^U,k=s0&(-s0);s0;s0^=k,k=s0&(-s0))
				f[s|k]=mo(mod-1ll*f[s]*fac[k]%mod*binom(U+1-A[i]-s,k-1)%mod+f[s|k]);
	int ans=0;
	for(int s=U;~s;--s)
		ans=mo(ans+1ll*f[s]*fac[U-s]%mod*(U+1)%mod);
	write(ans),pc('\n');
	return 0;
}


Measured memory_bytes: 4376
#include<iostream>
using namespace std;
typedef long long ll;
const ll maxn = 3e6, mod = 998244353;
ll n, a, b, k;
ll numa, numb, ans = 0;
ll f[maxn + 1], inv[maxn + 1];

ll qpow(ll a, ll b) {
	ll ret = 1;
	while (b) {
		if (b & 1) ret = ret * a % mod;
		a = a * a % mod; b >>= 1;
	}
	return ret;
}
ll C(int n, int m) {
	if (n < m) return 0;
	return f[n] * inv[m] % mod * inv[n - m] % mod;
}
void init() {
	f[0] = 1;
	for (ll i = 1; i <= n; i++) {
		f[i] = f[i - 1] * i % mod;
	}
	inv[n] = qpow(f[n], mod - 2);
	for (int i = n - 1; i >= 0; i--)
		inv[i] = inv[i + 1] * (i + 1) % mod;
}

int main() {
	cin >> n>> a >>b >> k;
	if (k == 0) { 
		cout << 1 << endl;
		return 0;
	}
	init();
	for (numa = 0; numa <= n && numa * a <= k; numa++) {
		if ((k - numa * a) % b != 0) continue;
		numb = (k - numa * a) / b;
		if (numb > n) continue;
		ans = (ans + C(n, numa) * C(n, numb)) % mod;
	}
	printf("%lld", ans);
	return 0;
}


Measured memory_bytes: 8448
#define _CRT_SECURE_NO_WARNINGS
#include<cstring>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<string>
#include<stack>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<vector>
#include<sstream>
#include<iostream>
#include<algorithm>
//std::ios::sync_with_stdio(false);
using namespace std;
const int maxn = 1e5 + 5;
int ani[maxn];
char s[maxn];
int len;
int endd,begi;
bool execute() {
	int i = 1;
	while (i <= len - 1) {
		if (ani[i]) {
			if (s[i] == 'o')ani[i + 1] = ani[i - 1];
			else ani[i + 1] = !ani[i - 1];
		}
		else {
			if (s[i] == 'x')ani[i + 1] = ani[i - 1];
			else ani[i + 1] = !ani[i - 1];
		}
		i++;
	}
	if (ani[len - 1] == endd&&ani[len]==begi) return 1;
	else return 0;
};
void print() {
	for (int i = 0; i < len; i++) {
		if (ani[i])printf("S");
		else printf("W");
	}
}
int main() {
	cin >> len;
	scanf("%s", s);
	//1sheet,0wolf
	//case1 
	begi=ani[0] = 1;
	if (s[0] == 'o')
	{
		ani[1] = 1;  endd = 1; if (execute()) { print();return 0; } 
		ani[1] = 0;  endd = 0; if (execute()) { print();  return 0; }
	}
	else {
		ani[1] = 1;  endd = 0; if (execute()) { print();  return 0; }
		ani[1] = 0;  endd = 1; if (execute()) { print(); return 0; }
	}
	//case 2
	begi=ani[0] = 0;
	if (s[0] == 'x') {
		ani[1] = 1;  endd = 1; if (execute()) { print(); return 0; }
		ani[1] = 0;  endd = 0; if (execute()) { print(); return 0; }
	}
	else {
		ani[1] = 1;  endd = 0; if (execute()) { print();return 0; }
		ani[1] = 0;  endd = 1; if (execute()) { print();  return 0; }
	}
	cout << -1;
//system("pause");
return 0;
}


Measured memory_bytes: 768
n = gets.to_i

taro_point   = 0
hanako_point = 0

n.times do
  taro,hanako = gets.split.map(&:to_s)
  if taro > hanako
    taro_point   += 3
  elsif taro == hanako 
    taro_point   += 1
    hanako_point += 1
  elsif taro < hanako
    hanako_point += 3
  end

end

puts "#{taro_point} #{hanako_point}"



Measured memory_bytes: 6876
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<queue>
#define rep(i,l,r) for (int i=l;i<=r;i++)
#define down(i,l,r) for (int i=l;i>=r;i--)
#define clr(x,y) memset(x,y,sizeof(x))
#define maxn 200500
#define inf (int)1e9
#define ll long long
#define mm 1000000007
#define eps 1e-9
#define low(x) x&(-x)
#define pb push_back
#define mp make_pair
#define PII pair<int,int>
using namespace std;

ll read(){
    ll x=0,f=1; char ch=getchar();
    while (!isdigit(ch)) {if (ch=='-') f=-1; ch=getchar();}
    while (isdigit(ch)){x=x*10+ch-'0'; ch=getchar();}
    return x*f;
}
ll p[maxn],inv[maxn];
int pos[maxn],n,p1,p2;
ll Pow(ll x,ll y){
	ll ans=1;
	while (y) {
		if (y&1) ans=ans*x%mm;;
		x=x*x%mm;
		y/=2;
	}
	return ans;
}
ll c(int n,int m){
	if (n<m) return 0;
	return p[n]*inv[m]%mm*inv[n-m]%mm;
}
int main(){
//	freopen("in.txt","r",stdin);
//	freopen("out.txt","w",stdout);
	n=read();
	p[0]=1; rep(i,1,n) p[i]=(1LL*p[i-1]*i)%mm;
	inv[n]=Pow(p[n],mm-2);
	down(i,n,1) inv[i-1]=1LL*inv[i]*i%mm;
//	rep(i,0,n) printf("%lld ",p[i]); puts("");
//	rep(i,0,n) printf("%lld ",inv[i]); puts("");
	rep(i,1,n+1) {
		int x=read();
		if (pos[x]) p1=pos[x],p2=i;
		pos[x]=i; 
	}
	int len=p1-1+n+1-p2;
	rep(i,1,n) {
		printf("%lld\n",(c(n,i)+c(n,i-1)-c(len,i-1)+mm)%mm);
	}
	puts("1");
    return 0;
}

Measured memory_bytes: 3200