akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <utility>
#include <vector>
using namespace std;

#define fi first
#define se second
#define x first
#define y second
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
#define EPS 1e-9

int UF[128];
int rank[128];

void UF_init() {
	for(int i = 0; i < 128; i++) {
		UF[i] = i;
		rank[i] = 1;
	}
}

bool UF_same(int a, int b) {
	int pa, pb;
	pa = a; pb = b;
	while(UF[pa] != pa)
		pa = UF[pa];
	while(UF[pb] != pb)
		pb = UF[pb];

	if(pa == pb)
		return true;
	return false;
}

void UF_merge(int a, int b) {
	int pa, pb;
	pa = a;
	while(UF[pa] != pa)
		pa = UF[pa];
	pb = b;
	while(UF[pb] != pb)
		pb = UF[pb];

	if(rank[pa] > rank[pb]) {
		UF[pb] = pa;
	}
	else {
		if(rank[pa] == rank[pb])
			rank[pa]++;
		UF[pa] = pb;
	}
}

bool inside(pii p, vector<pii> rect) {
	vector<pii> v;
	for(int i = 0; i < rect.size(); i++) {
		v.push_back(pii(rect[i].x - p.x, rect[i].y - p.y));
	}

	bool ret = true;
	for(int i = 0; i < v.size(); i++) {
		if(v[i].x * v[(i+1)%v.size()].y - v[i].y * v[(i+1)%v.size()].x > 0)
			ret = false;
	}

	return ret;
}

int cross_product(pii a, pii b) {
	return a.x * b.y - a.y * b.x;
}

int inner_product(pii a, pii b) {
	return a.x * b.x + a.y * b.y;
}

bool cross(vector<pii> r0, vector<pii> r1) {
	for(int i = 0; i < r0.size(); i++) {
		for(int j = 0; j < r1.size(); j++) {
			pii a, b, c;
			a = pii(r1[j].x - r0[i].x, r1[j].y - r0[i].y);
			b = pii(r1[(j+1)%r1.size()].x - r0[i].x, r1[(j+1)%r1.size()].y - r0[i].y);
			c = pii(r0[(i+1)%r0.size()].x - r0[i].x, r0[(i+1)%r0.size()].y - r0[i].y);

			if(cross_product(a, b) == 0) {
				if(inner_product(a,b) <= 0)
					return true;
			}

			else {
				double s, t;
				s = (double)cross_product(c,b) / cross_product(a,b);
				t = (double)cross_product(a,c) / cross_product(a,b);
				if(s + EPS > 0 && t + EPS > 0 && s + t + EPS > 1)
					return true;
			}
		}
	}

	return false;
}

int main() {
	int N;
	while(cin >> N, N) {
		for(int n = 0; n < N; n++) {
			int M;
			vector<vector<pii> > poly;
			cin >> M;
			for(int t = 0; t < M; t++) {
				vector<pii> v;
				for(int i = 0; i < 4; i++) {
					pii tmp;
					cin >> tmp.x >> tmp.y;
					v.push_back(tmp);
				}
				poly.push_back(v);
			}
			UF_init();
			for(int i = 0; i < poly.size(); i++) {
				for(int j = 0; j < poly.size(); j++) {
					int merge_flg = false;
					for(int k = 0; k < poly[j].size(); k++) {
						if(inside(poly[j][k], poly[i]))
							merge_flg = true;
					}
					if(cross(poly[i],poly[j]))
						merge_flg = true;
					if(merge_flg && !UF_same(i,j)) {
						UF_merge(i, j);
					}
				}
			}

			int ans = 0;
			for(int i = 0; i < M; i++) {
				if(UF[i] == i)
					ans++;
			}
			cout << ans << endl;
		}
	}
}

Measured memory_bytes: 1212
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <list>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdlib>

using namespace std;

#define ALL(c) c.begin(),c.end()
#define RALL(c) c.rbegin(),c.rend()
#define SORT(x) sort((x).begin(),(x).end())
#define REP(i,x,y) for(int i=(x);i<(y);++i)
#define MP(a,b) make_pair((a),(b))
#define debug(x) #x << "=" << (x)
 
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define dump(x)
#endif

typedef long long int ll;
typedef pair<int,int> pii;
//template<typename T> using vec=std::vector<T>;

const int INF=1<<30;
const long long int INF_=1LL<<58;
const double EPS=1e-9;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
	os << "[";
	for (const auto &v : vec) {
		os << v << ",";
	}
	os << "]";
	return os;
}

unordered_map<string,bool> visited;

void Merge(const string &grp,map<string,vector<string>> &m,unordered_set<string> &members){
	if(visited[grp]) return;
	visited[grp]=true;
	
	const auto &names=m[grp];
	for(auto &name:names){
		if(m.count(name)==1) Merge(name,m,members);
		else members.insert(name);
	}
}

void Solve(){
	while(true){
		int n;
		cin >> n;
		if(!n) break;
		map<string,vector<string>> m;
		string first;
		REP(i,0,n){
			string s;
			cin >> s;
			int idx=0;
			string grp;
			REP(j,0,s.size()){
				if(s[j]==':'){
					grp=s.substr(0,j);
					if(i==0) first=grp;
					idx=j+1;
				}
				if(s[j]==','||s[j]=='.'){
					string sub=s.substr(idx,j-idx);
					m[grp].push_back(sub);
					idx=j+1;
				}
			}
		}

		unordered_set<string> members;
		visited.clear();
		Merge(first,m,members);
		cout << members.size() << endl;
	}
}

int main(){
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	Solve();
	return 0;
}

Measured memory_bytes: 1380
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <string>
#include <string.h>
#include <map>
#include <math.h>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <deque>
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+50;
const int inf=0x3f3f3f3f;
int n,k;
int a[200050];
bool vis[200050];
vector<int >g[200050];
void bfs()
{
    queue<int>q;
    q.push(1);
    while(q.size())
    {
        int x=q.front();
        q.pop();
        vis[x]=1;
        for(int i=0;i<g[x].size();i++)
        {
            int v=g[x][i];
            if(!vis[v])
            {
                a[v]+=a[x];
                q.push(v);
            }
        }
    }
}
int main()
{
    //freopen("/Users/zilongzhang/Desktop//l.txt","r",stdin);
       scanf("%d %d",&n,&k);
        for(int i=1;i<=n-1;i++) {
            int x, y;
            scanf("%d %d", &x, &y);
            g[x].push_back(y);
            g[y].push_back(x);
        }
        while(k--)
        {
            int l,b;
            scanf("%d %d",&l,&b);
            a[l]+=b;
        }
        bfs();
        for(int i=1;i<=n;i++)
            printf("%d ",a[i]);
    return 0;
}


Measured memory_bytes: 15732
#include <bits/stdc++.h>
#define itn int
#define REP(i, n) for (int i = 0; i < n; i++)
#define IREP(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(a, b) for (int i = a; i < b + 1; i++)
#define all(v) v.begin(), v.end()
#define SENTINEL 2000000000
#define NIL -1
using namespace std;
typedef long long ll;

const ll INF = 1LL << 60;
const ll MOD = 1000000007;
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;}

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

Measured memory_bytes: 768
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define vii vector<ll> 
#define pb push_back
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
const int MOD = 1e9 + 7, N = 1e4 + 3;

int main(){
    fast;
    ld a, b; cin >> a >> b;
    cout << fixed << setprecision(6) << a/b << "\n";
    cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
    return 0;
}

Measured memory_bytes: 3756
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String b  = sc.next();
        if(b.equals("A")) System.out.println("T");
        else if(b.equals("T")) System.out.println("A");
        else if(b.equals("C")) System.out.println("G");
        else if(b.equals("G")) System.out.println("C");
    }
}


Measured memory_bytes: 23764
#include <iostream>
#include <stdio.h>
using namespace std;

const int K = 1000;

int main () {
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    if (a%c==0 && b%d==0) puts("No");
    else {
        puts("Yes");
        for (int i=1;a>=i;i++) {
            for (int j=1;b>=j;j++) {
                if (j!=1) printf(" ");
                if (i%c==0&&j%d==0) {
                    printf("%d",-(1+K*(c*d-1)) );
                }
                else printf("%d",K);
            }
            puts("");
        }
    }
}



Measured memory_bytes: 1536
from heapq import heappush, heappop
H, W = map(int, input().split())
s = [input() for _ in range(H)]

dist = [[float('inf')] * W for _ in range(H)]
q = [(0, 0, 0)]
while q :
    cost, cx, cy = heappop(q)
    if cost >= dist[cy][cx] :
        continue
    dist[cy][cx] = cost
        
    for dx, dy in ((0, 1), (0, -1), (1, 0), (-1, 0)) :
        if 0 <= cx + dx < W and 0 <= cy + dy < H and s[cy+dy][cx+dx] != '#' :
            heappush(q, (cost+1, cx+dx, cy+dy))
            
if dist[H-1][W-1] == float('inf') :
    print(-1)
else :
    ret = 0
    for s_ in s :
        ret += s_.count('#')
    print(H * W - ret - dist[H-1][W-1] - 1)

Measured memory_bytes: 43632
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
#define Add(x, y) x = (x + (y)) % mod
#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int A, B; cin >> A >> B;
    if(A >= 13) Out(B);
    else if(A >= 6) Out(B / 2);
    else Out(0);  

    return 0;
}


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

int main(){
  int n, m;
  cin >> n >> m;
  
  vector<lli> a(n);
  //pair(c,b)
  vector<pair<lli, lli>> cb(m);
  for(int i = 0; i < n; i++)
    cin >> a[i];
  for(int i = 0; i < m; i++)
    cin >> cb[i].second >> cb[i].first;

  sort(cb.begin(), cb.end(), greater<pair<lli, lli>>());
  sort(a.begin(), a.end());
  //
  int a_index = 0;
  for(int i = 0; i < m; i++){
    for(int j = 0; j < cb[i].second; j++){
      if(cb[i].first < a[a_index])
        break;
      a[a_index] = cb[i].first;
      a_index++;
    }
  }
  lli sum = accumulate(a.begin(), a.end(), 0LL);
  cout << sum << endl;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using ll=long long;
using namespace std;
#define rep_i(i, n) for (int i = 0; i < (n); ++i)
#define rep_ll(i, n) for (long long i = 0; i < (n); ++i)
#define r_rep_i(i, start, end) for (int i = (start); i < (end); ++i)
#define r_rep_ll(i, start, end) for (long long i = (start); i < (end); ++i)
#define debug_vi(v) copy((v).begin(), (v).end(), ostream_iterator<int>(cout, " "));
#define debug_vll(v) copy((v).begin(), (v).end(), ostream_iterator<long long>(cout, " "));
#define debug_vd(v) copy((v).begin(), (v).end(), ostream_iterator<double>(cout, " "));
#define sort_v(v) sort((v).begin(), (v).end()); //昇順
#define d_sort_vi(v) sort((v).begin(), (v).end(), greater<int>()); //降
#define d_sort_vll(v) sort((v).begin(), (v).end(), greater<long long>()); //降
#define d_sort_vd(v) sort((v).begin(), (v).end(), greater<double>()); //昇順
#define say(t) cout << (t) << endl;
#define sum_vi(v) accumulate((v).begin(), (v).end(), 0);
#define sum_vll(v)accumulate((v).begin(), (v).end(), 0LL);

ll gcd(ll a, ll b) { return b?gcd(b, a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a, b)*b;}
const int IINF=(1<<30);
const ll LLINF = 1LL<<60;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  int a, b, c;cin >> a >> b >> c;
  if(a == b + c || b == a+c || c == a+b){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
//code by parshuram_84
#include <bits/stdc++.h>
#define mod 1000000007
#define pii pair<int,int>
#define pll pair<long long,long long>
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);cout.precision(dbl::max_digits10);
#define pb push_back
#define mod 1000000007 //998244353
#define ll long long
#define vi vector<int>
#define vll vector<long long>
#define vp vector<pair<long long,long long>>
#define vpp vector<pair<pair<long long,long long>,long long>>
#define mp make_pair
typedef std::numeric_limits< double > dbl;
using namespace std;
 
ll power(ll a,ll b)
{
	ll z=1,p=mod;
	while(b>0)
	{
		if(b&1) z=(z*a)%p;
		a=(a*a)%p;
		b=b>>1;
	}
	return z;
}
 
int main() {
	IOS;
	ll i,k,a,b,c=100,x;
	cin>>x;
	for(i=1;i<1e8;i++)
	{
		c+=c/100;
		if(c>=x)
		{
			cout<<i;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 3604
# coding: utf-8

s = input().rstrip().split(' ')
n, m, c = int(s[0]),int(s[1]),int(s[2])

b = input().rstrip().split(' ')

a = []
count = 0
sum = c
for i in range(n):
    a = input().rstrip().split(' ')
    for j in range(m):
        sum += int(a[j])*int(b[j])
    a.clear()
    if sum > 0:
        count += 1
    sum = c

print(count)



Measured memory_bytes: 3064
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let n = read::<i64>();
    let mut ans = 1;
    for b in 2..1000i64 {
        for p in 2..11 {
            let temp = b.pow(p);
            if temp > n {
                break;
            }
            ans = max(ans, temp);
        }
    }
    println!("{}", ans);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 4352
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>

using namespace std;

#define ll long long
#define el '\n'
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repi(i, a, b) for (int i = a; i >= b; i--)
#define VI vector<int>
#define VII vector<pair<int, int>>
#define PII pair<int, int>
#define MP make_pair
// #define log(fmt, ...) printf(fmt, ##__VA_ARGS__)
#define log(fmt, ...)
// #define check(...) assert(##__VA_ARGS__)
#define check(...)

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

    int n;
    cin >> n;
    int a[n];
    ll cnt[n + 1];
    fill_n(cnt, n + 1, 0);
    rep(i, 0, n) {
        cin >> a[i];
        cnt[a[i]]++;
    }
    ll all = 0;
    rep(i, 1, n+1) {
        if (cnt[i] > 1) {
            log("cnt[%d]=%d\n", i, cnt[i]);
            all += cnt[i] * (cnt[i] - 1) / 2;
        }
    }
    rep(i, 0, n) {
        if (cnt[a[i]] <= 1) {
            cout << all << el;
        } else {
            ll x = cnt[a[i]];
            ll become = all - (x * (x - 1) / 2) + (x - 1) * (x - 2) / 2;
            cout << become << el;
        }
    }
    // vector<int> a;
    // rep(i,0,n) {
    //     int x;
    //     cin >> x;
    //     a.push_back(x);
    // }
    // vector<int> b(a);
    // sort(begin(b), end(b));
    // vector<pair<int, int>> cnt;
    // int prev = -1;
    // rep(i,0,n) {

    // }
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
struct Edge {
    int to;     // 辺の行き先
    int weight; // 辺の重み
    Edge(int t, int w) : to(t), weight(w) { }
};
using Graph = vector<vector<int> >;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define rrep(i,m, n) for(int i = m; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define mk make_pair
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<int>(n,a)));
typedef long long ll;
const int INF = 2000000000;
const long INF64 = 1000000000000000ll;
const ll MOD = 1000000007LL;
typedef unsigned int uint;
int main(){
    string s,t;
    std::cin >> s>>t;
    std::vector<std::vector<int>> p(26);
    rep(i,s.size()){
        p[s[i]-'a'].pb(i+1);
    }
    if(p[t[0]-'a'].size()==0){
        std::cout << -1 << std::endl;
        exit(0);}
    ll cou=0ll;
    ll moji=0ll;
    moji=*(lb(all(p[t[0]-'a']),moji));
    
    rep(i,t.size()-1){
    //    std::cout << moji << std::endl;
        if(p[t[i+1]-'a'].size()==0){
        std::cout << -1 << std::endl;
        exit(0);}
        if(ub(all(p[t[i+1]-'a']),moji)!=p[t[i+1]-'a'].end()){
            moji=*(ub(all(p[t[i+1]-'a']),moji));
        }
        else{
            
            moji=*(ub(all(p[t[i+1]-'a']),0ll));
            cou++;   
            //std::cout << moji << std::endl;
        }
        //std::cout << moji << std::endl;
    }
    
   // std::cout << moji << std::endl;
    //std::cout << cou << std::endl;
    std::cout << cou*s.size()+moji << std::endl;
    
}


Measured memory_bytes: 1216
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
#define pb push_back
#define fi first
#define se second
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
const int maxn=1e5+10;
const int mod=1e9+7;
const int inf=0x3f3f3f3f;
int main()
{
    ios::sync_with_stdio(false);cin.tie(0);
    ll n,a,b;
    cin>>n>>a>>b;
    ll ans=n,xx=b-a;
    if(xx%2==0) ans=min(ans,xx/2);
    else 
    {
        ans=min(ans,min(a,b)+xx/2);
        ans=min(ans,n-max(a,b)+1+xx/2);
    }
    cout<<ans<<'\n';
    return 0;
}



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

int main()
{
  int k;
  cin >> k;
  rep(i,k) {
    cout << "ACL";
  }
  return 0;
}

Measured memory_bytes: 3588
import math

s = list(map(float, input().split()))
htheta = 30.0*s[2]+0.5*(s[3]) #hの角度
mtheta = 6.0*(s[3]) #mの角度
theta = abs(htheta-mtheta)
if theta > 180:
    theta = 360 - theta 
r = math.sqrt(s[0]**2+s[1]**2-2*s[0]*s[1]*math.cos(math.radians(theta)))
print(r)

Measured memory_bytes: 9336
/******************************************************************************

            EYENINE,THE ELDER_WAND!!!
            THE ROOT OVER MINUS EIGTHY ONE!!

*******************************************************************************/

#include<bits/stdc++.h>
using namespace std;
int a[10005];
int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,sum=0;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
        while(a[i]%2==0){
            a[i]/=2;
            sum++;
        }
    }
    cout<<sum<<endl;

    return 0;
}


Measured memory_bytes: 3612
#include <iostream>
#include <queue>
#include <vector>

#define MAXN 2000
#define WHITE 0
#define GRAY 1
#define BLACK 2

using namespace std;


int x,y;
int color[MAXN+1];
int d[MAXN+1][MAXN+1];
int cnt[MAXN];

void dicstra ( int root, int n  ) {

  for ( int i = 0; i < n; ++i ) color[i] = WHITE;
  queue<int> Q;
  d[root][root] = 0;
  color[root] = GRAY;
  Q.push(root);

  while( !Q.empty() ) {
    int pos = Q.front(); Q.pop();

    if ( pos-1 >= 0 && color[pos-1] == WHITE ) {
      d[root][pos-1] = d[root][pos]+1;
      color[pos-1] = GRAY;
      Q.push(pos-1);
    }
    if ( pos+1 < n && color[pos+1] == WHITE ) {
      d[root][pos+1] =d[root][pos]+1;
      color[pos+1] = GRAY;
      Q.push(pos+1);
    }
    if ( pos == x && color[y] == WHITE ) {
      d[root][y] = d[root][pos]+1;
      color[y] = GRAY;
      Q.push(y);
    }
    if ( pos == y && color[x] == WHITE ) {
      d[root][x] = d[root][pos]+1;
      color[x] = GRAY;
      Q.push(x);
    }

    color[pos] = BLACK;
  }

}

void cal ( int n )
{
  for ( int i = 0; i < n; ++i ) dicstra(i,n);
  for ( int i = 0; i < n; ++i ) {
    for ( int j = 0; j < n; ++j ) ++cnt[d[i][j]];
  }
}

int main()
{
  int n;

  cin >> n;
  cin >> x >> y;
  --x; --y;

  cal(n);

  for ( int i = 1; i < n; ++i ) {
    cout << cnt[i]/2 << "\n";
  }
}


Measured memory_bytes: 15872
import java.util.*;

public class Main {

	public static void main (String[] args){
		
		Scanner sc = new Scanner(System.in);
		
		String a = sc.nextLine();
				
		StringBuilder sb = new StringBuilder();
		
		for (char c : a.toCharArray()){
			
			if(c != 'B'){
				sb.append(c);
			}
			else{
				if(sb.length() != 0){
					sb.deleteCharAt(sb.length() - 1);
				}
			}
		}
		System.out.println(sb.toString());
	}
}


Measured memory_bytes: 9420
#include <iostream>
#include <vector>
#include <utility>
#include <cassert>
#include <queue>
#ifndef LIB_TYPEDEF_LL_HPP
#define LIB_TYPEDEF_LL_HPP
typedef long long ll;
typedef unsigned long long ull;
#endif
#ifndef LIB_REPEAT_HPP
#define LIB_REPEAT_HPP
#define repeat(i,n) for (int i = 0; i < (n); ++i)
#define repeat_from(i,m,n) for (int i = (m); i < (n); ++i)
#define repeat_one(i,n) for (int i = 1; i <= (n); ++i)
#define repeat_rev(i,n) for (int i = (n)-1; 0 <= i; --i)
#define foreach(it, cont) for (decltype(cont.begin()) it = cont.begin(); it != cont.end(); ++it)
#endif
using namespace std;

// avoid name conflict
#define left  LEFT
#define right RIGHT

int W, H;
const int dx[] = {  0,  0, -1,  1 };
const int dy[] = { -1,  1,  0,  0 };
enum direction { up, down, left, right };
const direction rgt[] = { right, left, up, down };
const direction bck[] = { down, up, right, left };
const direction lft[] = { left, right, down, up };
struct state { int x, y; direction d; };
bool is_valid(const state & s) { return 0 <= s.y and s.y < H and 0 <= s.x and s.x < W and 0 <= s.d and s.d < 4; }
int encode(const state & s) { assert (is_valid(s)); return s.y*W*4 + s.x*4 + s.d; }
bool operator < (const state & a, const state & b) { return encode(a) < encode(b); }

int main() {
    ios_base::sync_with_stdio(false);
    W = 3; H =4;
    while (true) {
        cin >> W >> H;
        if (W == 0 and H == 0) break;
        vector<vector<int> > S(W, vector<int>(H));
        repeat (h,H) repeat (w,W) cin >> S[w][h];
        vector<int> C(4); repeat (i,4) cin >> C[i];

        vector<bool> used(W*H*4);
        priority_queue<pair<ll,state>, vector<pair<ll,state> >, greater<pair<ll,state> > > que;
        que.push(make_pair(0, (state) { 0, 0, right }));
        while (true) {
            const ll cost = que.top().first;
            const state s = que.top().second;
            que.pop();
            if (s.x == W-1 and s.y == H-1) {
                cout << cost << endl;
                break;
            }
            if (not used[encode(s)]) {
                used[encode(s)] = true;
                repeat (instr,4) {
                    state t = s;
                    switch (instr) {
                        case 0: break; // straight
                        case 1: t.d = rgt[t.d]; break; // right
                        case 2: t.d = bck[t.d]; break; // back
                        case 3: t.d = lft[t.d]; break; // left
                        default: assert(false);
                    }
                    t.x += dx[t.d];
                    t.y += dy[t.d];
                    if (is_valid(t)) {
                        ll dcost = instr == S[s.x][s.y] ? 0 : C[instr];
                        if (not used[encode(t)]) {
                            que.push(make_pair(cost+dcost, t));
                        }
                    }
                }
            }
        }
    }
    return 0;
}

Measured memory_bytes: 1356
#include<bits/stdc++.h>
using namespace std;
const int MAX=2005;
const int mod=1e9+7;
#define ll long long 
#define endl '\n'
#define _for(i,j,k) for(int i=j;i<k;i++)
int gcd(int a, int b){return a % b ? gcd(b, a % b) : b;}
int lcm(int a, int b){return a * b / gcd(a, b);}
ll qpow(int a,int b,int mod){ll ans=1;while(b){if(b&1)ans=ans*a%mod;a*=a;b>>=1; }}
int a[MAX];
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n,x,y;
	cin>>n>>x>>y;
	for(int i=1;i<=n;i++)
	{
		for(int j=i+1;j<=n;j++)
		{
			int p=min(abs(i-j),abs(i-x)+abs(j-y)+1);
			a[p]++;
		 }
	} 
	for(int i=1;i<=n-1;i++)
	cout<<a[i]<<'\n';
}
 

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int h = sc.nextInt();
    int w = sc.nextInt();
    int d = sc.nextInt();
    int n = h * w;
    long[] sum = new long[n + 1];
    long[] x = new long[n + 1];
    long[] y = new long[n + 1];
    for(int i = 0; i < h; i++) {
      for(int j = 0; j < w; j++) {
        int a = sc.nextInt();
        x[a] = i;
        y[a] = j;
      }
    }
    for(int i = 1; i <= n; i++) {
      if(i > d) {
        sum[i] = (sum[i - d] + Math.abs(x[i] - x[i - d]) + Math.abs(y[i] - y[i - d]));
      }
    }
    int q = sc.nextInt();
    for(int i = 0; i < q; i++) {
      int l = sc.nextInt();
      int r = sc.nextInt();
      System.out.println(sum[r] - sum[l]);
    }
  }
}

Measured memory_bytes: 101580
def main():
    from operator import mul
    from functools import reduce
    def cmb(n, r):
        r = min(n - r, r)
        if r == 0: return 1
        over = reduce(mul, range(n, n - r, -1))
        under = reduce(mul, range(1, r + 1))
        return over // under
    def factorization(n):
        arr = []
        temp = n
        for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
            if temp % i == 0:
                cnt = 0
                while temp % i == 0:
                    cnt += 1
                    temp //= i
                arr.append([i, cnt])
        if temp != 1:
            arr.append([temp, 1])
        if arr == []:
            arr.append([n, 1])
        return arr

    large_p = 10 ** 9 + 7
    n, m = map(int, input().split())
    mp = factorization(m)
    r = 1
    for mpe in mp:
        tmp = cmb(mpe[1] + n - 1, n - 1)
        r = r * tmp
        r = r % large_p
    if r < 0:
        r += large_p
    if m == 1:
        print(1)
    else:
        print(r)

if __name__ == '__main__':
    main()

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

int main(){
    int N;
    scanf("%d", &N);
    int d1[100], d2[100];
    for(int i=0; i<N; i++){
        scanf("%d %d", d1+i, d2+i);
    }
    bool ansQ[3] = {false, false, false};
    
    int pos = 0;
    for(int i=0; i<N; ++i){
        ansQ[pos] = d1[i] == d2[i];
        if(ansQ[pos] && ansQ[(pos+1)%3] && ansQ[(pos+2)%3] ){
            printf("Yes\n");
            return 0;
        } 
        pos = (pos+1)%3;
    }
    printf("No\n");
    return 0;
}


Measured memory_bytes: 3760
parseInt(x) = parse(Int, x)
MOD = 10^9 + 7
n,a,b = parseInt.(split(readline()))

function inv(x)
    return powermod(x, MOD-2,MOD)
end

function choose(p,q)
    x = 1
    y = 1
    for i in 1:q
        x = x * (p-i+1) % MOD
        y = y * i % MOD
    end
    return x * inv(y) % MOD
end

ans = powermod(2,n,MOD) - 1
ans = (ans - choose(n,a) + MOD)%MOD
ans = (ans - choose(n,b) + MOD)%MOD
println(ans%MOD)

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

#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define deb(x)	cout << #x << " " << x << endl;

typedef long long int ll;

int main() {

	IOS

	int x;
	cin >> x;
	cout << (x >= 30 ? "Yes" : "No");
	
	return 0;
}

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

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

int N, M;
vector<int> adj[100010], tree[100010];
int tin[100010], tout[100010], dep[100010], capa[100010], sz0[100010], sz1[100010], timer = 0, A, B;
ll ans = 0;

int f(int u) {
    return abs(sz0[u] - sz1[u]);
}

void dfs0(int u, int p, int d) {
    tin[u] = timer++;
    dep[u] = d;
    capa[u] = d;

    for(int i = 0; i < adj[u].size(); i++) {
        int v = adj[u][i];
        if(v == p) continue;
        if(tin[v] != -1) {
            if(tin[v] < tin[u]) A = u, B = v;
            continue;
        }

        dfs0(v, u, d ^ 1);
        tree[u].push_back(v);
    }

    tout[u] = timer;
}

void dfs2(int u) {
    sz0[u] = dep[u]? 0 : 1;
    sz1[u] = capa[u];

    for(int i = 0; i < tree[u].size(); i++) {
        int v = tree[u][i];
        dfs2(v);
        sz0[u] += sz0[v];
        sz1[u] += sz1[v];
    }
}

vector<int> val;

void dfs1(int u) {
    for(int i = 0; i < tree[u].size(); i++) {
        int v = tree[u][i];
        dfs1(v);
    }

    if(u) {
        if(tin[u] <= tin[A] && tin[A] < tout[u] && !(tin[u] <= tin[B] && tin[B] < tout[u])) {
            if(sz1[u] >= sz0[u]) val.push_back(f(u));
            else val.push_back(-f(u));
        }
        else if(!(tin[u] <= tin[A] && tin[A] < tout[u]) && tin[u] <= tin[B] && tin[B] < tout[u]) {
            if(sz1[u] >= sz0[u]) val.push_back(-f(u));
            else val.push_back(f(u));
        }
        else {
            ans += f(u);
        }
    }
}

int main() {
    scanf("%d %d", &N, &M);

    for(int i = 0; i < M; i++) {
        int a, b; scanf("%d %d", &a, &b);
        a--; b--;

        adj[a].push_back(b);
        adj[b].push_back(a);
    }

    memset(tin, -1, sizeof(tin));
    dfs0(0, -1, 0);
    dfs2(0);

    if(M == N - 1) {
        if(sz1[0] * 2 != N) {
            printf("-1");
            return 0;
        }

        for(int i = 1; i < N; i++) ans += f(i);
        printf("%d", ans);
        return 0;
    }
    if(capa[A] == capa[B]) {
        if(N % 2) {
            printf("-1");
            return 0;
        }

        if(N < 2 * sz1[0]) {
            for(int i = 0; i < N; i++) tree[i].clear();
            memset(tin, -1, sizeof(tin));
            timer = 0;

            dfs0(0, -1, 1);
            dfs2(0);
        }

        capa[A] += (N - 2 * sz1[0]) / 2;
        capa[B] += (N - 2 * sz1[0]) / 2;
        ans += (N - 2 * sz1[0]) / 2;

        dfs2(0);

        for(int i = 1; i < N; i++) ans += f(i);
        printf("%lld", ans);
        return 0;
    }
    if(sz1[0] * 2 != N) {
        printf("-1");
        return 0;
    }
    dfs1(0);
    val.push_back(0);
    sort(val.begin(), val.end());

    int mid = val[ val.size() / 2 ];
    for(int i = 0; i < val.size(); i++) {
        ans += abs(val[i] - mid);
    }

    printf("%lld", ans);
}


Measured memory_bytes: 23552
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define erep(i,n) for(int i = 0;i<=n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
#define erep1(i,n) for(int i = 1;i<=n;i++)
typedef long long ll;
#define vint vector<int>
#define vstring vector<string>
#define vll vector<ll>
#define vbool vector<bool>
#define INF 100000000


ll gcm(ll a,ll b);
ll lcm(ll a,ll b);
ll fac(ll a);

int main(){
  int n;
  cin >> n;
  int sum = 0;
  int key = INF;
  rep(i,n){
    int a;
    cin >> a;
    sum += a;
    if(a % 10 != 0 && a < key){
      key = a;
    }
  }
  if(key == INF){
    cout << 0 << endl;
  }
  else if(sum % 10 == 0){
    cout << sum - key << endl;
  }
  else{
    cout << sum << endl;
  }
}

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

int main() {
	char str[25];
	for (int i = 0; i < 25; i++) {
		str[i] = '\0';
	}
	cin >> str;
	for (int i = 24; i >= 0; i--) {
		if (str[i] == '\0') continue;
		cout << str[i];
	}
	cout << endl;
	return 0;
}

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

int main(){

	ios_base::sync_with_stdio(0);
	cout.tie(0);
	cin.tie(0);

	int n;
	cin>>n;

	vector< pair<int,int> > p(n);
	for(int i=0 ; i<n ; ++i){
		int x,l;
		cin>>x>>l;

		p[i].first = x+l , p[i].second = x-l;
	}

	sort(p.begin(),p.end());
	int ans=0 , mr = INT_MIN;

	for(int i=0 ; i<n ; ++i){
		if( p[i].second >= mr ){
			ans++;
			mr = max(mr,p[i].first);
		}
	}

	cout<< ans ;
}

Measured memory_bytes: 1024
def delete_head_zeros(n):
	n = str(n)
	l = len(n)
	if "." in n:
		l = n.find(".")
	head_zeros = 0
	for i in range(l - 1):
		if n[i] == "0":
			head_zeros += 1
		else:
			break

	return n[head_zeros:]

# compare a, b
# a, b: int or string
def bigint_compare(a, b):
	a = delete_head_zeros(a)
	b = delete_head_zeros(b)
	if len(a) > len(b):
		return 1
	elif len(a) < len(b):
		return -1
	else:
		if a > b:
			return 1
		elif a < b:
			return -1
		else:
			return 0

# calculate a + b
# a, b: int or string
def bigint_plus(a, b):
	a = str(a)
	b = str(b)

	d = max([len(a), len(b)])
	a = '0' * (d - len(a)) + a
	b = '0' * (d - len(b)) + b

	ans = ""
	carry = 0
	for i in range(d):
		s = int(a[-i-1]) + int(b[-i-1]) + carry
		carry = s // 10
		ans = str(s % 10) + ans
	else:
		if carry:
			ans = str(carry) + ans

	return ans

# calculate a - b
# a, b: int or string
def bigint_minus(a, b): 
	a = str(a)
	b = str(b)
	M = []
	m = []
	sign = ""

	if len(a) > len(b) or (len(a) == len(b) and a >= b):
		[M, m] = [a, b]
	else:
		[M, m] = [b, a]
		sign = "-"
	m = '0' * (len(M) - len(m)) + m

	ans = ""
	borrow = 0
	for i in range(len(M)):
		s = int(M[-i-1]) - int(m[-i-1]) - borrow
		if s < 0:
			borrow = 1
			s += 10
		else:
			borrow = 0
		ans = str(s) + ans

	return sign + delete_head_zeros(ans)

# calculate a * b
# a, b: int or string
def bigint_multiply(a, b):
	a = str(a)
	b = str(b)

	md = []
	carry = 0
	for j in range(len(b)):
		mj = ""
		for i in range(len(a)):
			m = int(a[-i-1]) * int(b[-j-1]) + carry
			carry = m // 10
			mj = str(m % 10) + mj
		else:
			if carry:
				mj = str(carry) + mj
		md.append(mj)

	ans = 0
	for k in range(len(md)):
		ans = bigint_plus(md[k] + "0" * k, ans)

	return ans


# calculate a / b to d digits after decimal point
# a, b, d: int or string
def bigint_divide(a, b, d = 0):
	a = str(a)
	b = str(b)
	d = int(d)
	if d < 0:
		d = 0

	ans = ""
	r = ""
	for i in range(len(a) + d):
		q = 0
		if i < len(a):
			r += a[i]
		elif i == len(a):
			ans += "."
			r += "0"
		else:
			r += "0"

		if bigint_compare(r, b) == -1:
			ans += str(q)
		else:
			while bigint_compare(r, b) >= 0:
				r = bigint_minus(r, b)
				q += 1
			ans += str(q)

	return delete_head_zeros(ans)


a, b, x = [n for n in input().split(" ")]
c1 = bigint_divide(b, x)

if int(a) == 0:
  c2 = 0
else:
  c2 = bigint_divide(bigint_minus(a, 1), x)

if int(a) == 0:
  print(bigint_plus(bigint_minus(c1, c2), 1))
else:
  print(bigint_minus(c1, c2))


Measured memory_bytes: 9208
import math

def trial_division(target):
    dest = int(math.sqrt(target))
 
    for i in range(2,dest):
        if target % i == 0:
            return False
    return True

num = int(input())

loop = True
while(loop):
    is_next_prime = trial_division(num)
    if is_next_prime == True:
        print(num)
        loop = False
    num += 1

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define i_7 (ll)(1E9+7)
#define i_5 (ll)(1E9+5)
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=(ll)1E12;//10^12
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
const double EPS=1E-8;
////////////////////////////////////////

int a[2];
int main() {
    ios::sync_with_stdio(false);cin.tie(0);
    
    int n,p;cin>>n>>p;
    bool flag=false;
    rep(i,0,n-1){int k;cin>>k;flag|=k%2;}
    ll ans;
    if(flag){
       ans=(ll)pow(2,n-1);
    }else{
        if(p){
            ans=0;
        }else{
            ans=(ll)pow(2,n);
        }
    }cout<<ans;
    
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    int k = sc.nextInt();
    int ans = 0;

    for(int i = 1; i <= k; i++){
      for(int j = 1; j <= k; j++){
        for(int l = 1; l <= k; l++){
          ans += gcd(gcd(i, j), l);
        }
      }
    }

    System.out.println(ans);
  }

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


Measured memory_bytes: 35736
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace MyProject
{
    class Program
    {
        static void Main(string[] args)
        {
#if Local
            var sw = new Stopwatch();
            sw.Start();
            Console.SetIn(new StreamReader("input.in"));
#endif

            var solver = new Solver();
            solver.Solve();
#if Local
            Console.WriteLine($"{sw.ElapsedMilliseconds}ms");
#endif
        }
    }

    class Solver
    {
        public void Solve()
        {
            var items = Console.ReadLine().Split().Select(elem => int.Parse(elem)).ToArray();
            var H = items[0];
            var A = items[1];

            var answer = 0;
            while(H > 0)
            {
                answer++;
                H -= A;
            }

            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 13268
#include <iostream>
#include <vector>
#include <unordered_map>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
vector<int> parent;
vector<int> nodes;

int getParent(int x) {
  int y = x;
  while(y != parent[y]) {
    y = parent[y];
  }
  parent[x] = y;
  return y;
}

bool unite(int x, int y) {
  x = getParent(x);
  y = getParent(y);
  if(x == y) return false;

  if(nodes[x] < nodes[y]) swap(x, y);
  parent[y] = x;
  nodes[x] += nodes[y];
  return true;
}

bool isSame(int x, int y) {
  x = getParent(x);
  y = getParent(y);
  return (x == y);
}

int main(void) {
  int64_t N, M;
  cin >> N >> M;
  vector<int> P(N);
  unordered_map<int, int> pos;
  rep(i, N) {
    cin >> P[i];
    pos[P[i]] = i;
  }

  parent.resize(N);
  nodes.resize(N);
  rep(i, N) {
    parent[i] = i;
    nodes[i] = 1;
  }
  rep(i, M) {
    int x, y;
    cin >> x >> y;
    --x;
    --y;
    unite(x, y);
  }

  int answer = 0;
  for(int i = 1; i <= N; ++i) {
    if(isSame(i - 1, pos[i]))
      ++answer;
  }
  cout << answer << endl;
  return 0;
}


Measured memory_bytes: 5540
#include<bits/stdc++.h>
#include <array>
using namespace std;
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

template<class Ty>
using passive_queue = priority_queue<Ty, vector<Ty>, greater<Ty>>;

struct Problem {

	void Solve() {
		string S; cin >> S;
		rep(i, 3) if (S[i] == '7') { cout << "Yes" << endl; return; }
		cout << "No" << endl;
	}

	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << fixed << setprecision(10);
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define Rep(n) for (ll _ = 0; _ < (ll)(n); _++) 
#define fs first
#define sc second
#define _GLIBCXX_DEBUG

template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
ll min(int a,ll b){return min((ll)a,b);} ll min(ll a,int b){return min(a,(ll)b);}

template <class S>
void print(vector<S> &v){for(ll i=0; i<(ll)v.size(); i++){
		cerr << v[i] << ' ';
	}
	cerr << endl;
}
template <class S>
void print(vector<vector<S>> &v) {
  	for (ll i = 0; i < (ll)v.size(); i++) {
    	for (ll j = 0; j < (ll)v[i].size(); j++) {
      		cerr << v[i][j] << ' ';
    	}
    	cerr << endl;
  	}
}

int main(){
	int a,b; cin >> a >> b;
	cout << max({a+b, a-b, a*b}) << endl;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
)

func main() {
	var N int
	fmt.Scan(&N)

	a := make([]int, N)
	for i := range a {
		fmt.Scan(&a[i])
	}
	sort.Ints(a)

	ans := 0
	j := 0
	for i := N - 1; i >= 0; i-- {
		if j%2 == 0 {
			ans += a[i]
		} else {
			ans -= a[i]
		}
		j++
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include <stdio.h>
#include <stdlib.h>

int main () {
    int i, n = 0;
    int data[1000];

    int a, b;

    while(scanf("%d %d", &data[n], &data[n+1]) != EOF ) {
        n += 2;
    }

    for ( i = 0; i < n; i += 2 ) {
        int sum = data[i] + data[i+1];
        int digit = 1;
        while( sum >= 10 ) {
            sum /= 10;
            digit++;
        }

        printf("%d\n", digit);
    }
    return 0;
}

Measured memory_bytes: 604
"use strict"
let input=require('fs').readFileSync('/dev/stdin','utf8');
let arr=input.split(' ');
let a=parseInt(arr[0]);
let b=parseInt(arr[1]);
let c=parseInt(arr[2]);
let cnt=0;
for(let i=a;i<=b;i++){
  if(c%i===0)cnt++;
}
console.log(cnt);



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


int main(){
  ll N;
  cin>>N;
  ll h[N];
  rep(i,N) cin>>h[i];
  
  ll DP[N];
  DP[0]=0;
  DP[1]=abs(h[1]-h[0]);
  
  for(ll i=2;i<N;i++){
  	DP[i]=min(DP[i-1]+abs(h[i]-h[i-1]),DP[i-2]+abs(h[i]-h[i-2]));
  }
  
  cout<<DP[N-1];
}

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

int main() {
  int N,K,j;
  cin >> N >> K;
  for (int i = N;i <= K; i++){
    if(i / 10000 == i % 10 && i / 1000 % 10 == i % 100 / 10){
        j++;
    }
    else{
      continue;    
    }  
  }
  cout << j << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int N;
	scanf("%d",&N);
	if(N%10==2||N%10==4||N%10==5||N%10==7||N%10==9)printf("hon");
	else if(N%10==3)printf("bon");
	else printf("pon");
	return 0;
}

Measured memory_bytes: 1736
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
void solve(){
    int k,n;
    cin>>k>>n;
    int A[n];
    for(auto& i:A)cin>>i;
    int mx=0;
    ll sm=0;
    int tmp;
    for(int i=0;i<n-1;i++){
        tmp=A[i+1]-A[i];
        mx=max(mx,tmp);
        sm+=tmp;
    }
    tmp=k-A[n-1]+A[0];
    mx=max(mx,tmp);
    sm+=tmp;
    sm-=mx;
    cout<<sm;
}
void trials(){
    int t;
    for(cin>>t;t--;cout<<endl){
        solve();
    }
}
int main(){
    solve();
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <string>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <math.h>
#include <algorithm>
#include <numeric>

using namespace std;

// マクロ&定数 ============================================================
typedef unsigned int uint;
typedef long long ll;
//typedef pair<int, int> P;

typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<bool> vbool;
typedef vector<string> vstring;

typedef vector<pair<int, int>> vpint;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<double, double>> vpdouble;

typedef vector<vector<int>> vvint;
typedef vector<vector<ll>> vvll;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<bool>> vvbool;

const int c_YET = -1;
const int INF = 1e9 + 1;
const ll LLINF = 1e17 + 1;
const int DX[9] = { 0,0,1,-1, 1, 1, -1, -1, 0 }; // 4;４近傍
const int DY[9] = { 1,-1,0,0, 1, -1, 1, -1, 0 }; // 8:８近傍 9:(0,0)を含む
const ll MOD = 1e9 + 7; //10^9 + 7
const ll MAX = 1e9;
const double PI = 3.14159265358979323846264338327950288;
//========================================================================








int main() {

	//==================================
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(30);
	//==================================



	int N;
	cin >> N;
	vint X(N);
	for (int i = 0; i < N; i++) {
		cin >> X[i];
	}

	ll sum = LLINF;
	for (int p = 1; p < 100; p++) {

		ll local = 0;

		for (int i = 0; i < N; i++) {
			local += (X[i] - p) * (X[i] - p);
		}

		sum = min(sum, local);


	}

	cout << sum;







}


Measured memory_bytes: 256
#include <stdio.h>
#define ll int

//next_permutation
void nexp(ll*a,int cnt){
	int l=cnt-1,r=cnt-1;
	ll t;
	while(--l>=0&&a[l]>a[l+1]);
	if(l>=0){
		while(a[l]>a[r])r--;
		t=a[l];a[l]=a[r];a[r]=t;
	}
	for(l++,r=cnt-1;l<r;l++,r--)t=a[l],a[l]=a[r],a[r]=t;
}

int a[10];
int main(){
	int n;
	scanf("%d",&n);
	if(n==1){
		puts("1");
		return 0;
	}
	for(int i=0;i<n;i++)scanf("%d",a+i);
	int t=a[0];
	
	for(int i=0;i<n;i++)a[i]*=-1;
	nexp(a,n);
	for(int i=0;i<n;i++)a[i]*=-1;
	if(a[0]<=t)for(int i=0;i<n;i++)printf("%d%c",a[i],i==n-1?10:32);
	nexp(a,n);
	if(a[0]<=t)for(int i=0;i<n;i++)printf("%d%c",a[i],i==n-1?10:32);
	nexp(a,n);
	if(a[0]>=t)for(int i=0;i<n;i++)printf("%d%c",a[i],i==n-1?10:32);
	
	
}


Measured memory_bytes: 2112
//おまじない
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#define INF 1e9+7
#define roop(i,m,n) for(int i=m;i<n;i++)
#define mroop(i,m,n) for(int i=m;i<n;i--)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
using namespace std;
typedef long long int ll;


//(int)'a'は97 (int)'A'は65
//おまじない



int main() {

	char ori[101][101];
	char ans[201][101];
	int w, h;
	cin >> h >> w;

	roop(i, 0, h) {
		roop(j, 0, w) {
			cin >> ori[i][j];
		}
	}

	roop(i, 0, 2 * h) {
		roop(j, 0, w) {
			ans[i][j] = ori[(int)((i)/2)][j];
			ans[i + 1][j] = '\0';
			ans[i][j + 1] = '\0';
			ans[i + 1][j + 1] = '\0';
		}
	}

	roop(i, 0, 2 * h) {
		roop(j, 0, w) {
			cout << ans[i][j];
		}
		cout << endl;
	}

	return 0;
}


Measured memory_bytes: 256
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

MOD = 10**9+7

def modcmb(n, r, mod):
    r = min(r, n-r)
    x = 1
    y = 1
    for i in range(1,r+1):
        x *= i
        x %= MOD
        y *= n-i+1
        y %= MOD
    
    return y * pow(x, mod-2, mod) % mod


def main():
    X,Y = map(int, readline().split())

    x, y = 2 * X - Y, -X + 2 * Y
    if x < 0 or y < 0:
        print(0)
        exit()
    
    if x % 3 != 0 or y % 3 != 0:
        print(0)
        exit()
    
    x, y = x // 3, y // 3
    #print(x, y)

    ans = modcmb(x + y, x, MOD)
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064