akhauriyash/Code-Regression huggingface dataset:
//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}

const int MAXV = 1e5;
const int INF = 1e9;
struct edge{ int to, cap, rev; };
vector<edge> G[MAXV];
bool used[MAXV];

// from -> to へ向かう容量capの辺をグラフに追加
void add_edge(int from, int to, int cap){
  G[from].push_back((edge){to, cap, G[to].size()});
  G[to].push_back((edge){from, 0, G[from].size()-1});
}

int dfs(int v, int t, int f){
  if(v == t) return f;
  used[v] = true;
  REP(i, G[v].size()){
    edge &e = G[v][i];
    if(!used[e.to] && e.cap>0){
      int d = dfs(e.to, t, min(f, e.cap));
      if(d > 0){
	e.cap -= d;
	G[e.to][e.rev].cap += d;
	return d;
      }
    }
  }
  return 0;
}

int max_flow(int s, int t){
  int flow = 0;
  while(true){
    memset(used, 0, sizeof(used));
    int f = dfs(s, t, INF);
    if(f==0) return flow;
    flow += f;
  }
}

int a[575], b[575], c[575], d[575];

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

  int n;
  cin >> n;
  REP(i, n) cin >> a[i] >> b[i];
  REP(i, n) cin >> c[i] >> d[i];

  int s, t;
  s = 210, t = 220;
  REP(i, n) add_edge(s, i, 1);
  REP(i, n) add_edge(100+i, t, 1);
  
  REP(i, n){
    REP(j, n){
      if(a[i] < c[j] && b[i] < d[j]) {
	add_edge(i, 100+j, 1);	
      }
    }
  }

  cout << max_flow(s, t) << endl;
  
  return 0;
}


Measured memory_bytes: 2816
import java.util.Scanner;

public class Main {

	public static void main(String args[]){
		Scanner cin = new Scanner(System.in);
		String target = cin.next();
		cin.close();
		int position_a=target.length();
		int position_z=0;

		for(int i=0;i<target.length();i++){
			if(target.charAt(i)=='A'){
				if(i<position_a){
					position_a=i;
				}
			}else if(target.charAt(i)=='Z'){
				if(position_z<i){
					position_z=i;
				}
			}
		}

		System.out.println(position_z-position_a+1);
	}
}


Measured memory_bytes: 26664
N = int(input())
l = [list(map(int, input().split())) for _ in range(N)]

for x, y, h in l:
    if h == 0:
        continue
    for Cx in range(0, 101):
        for Cy in range(0, 101):
            H = abs(Cx-x) + abs(Cy-y) + h
            if all(hh == max(H - abs(Cx-xx) - abs(Cy-yy), 0) for xx, yy, hh in l):
                print(Cx, Cy, H)
                exit()
                

Measured memory_bytes: 3064
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int M = sc.nextInt();
        
        int[][] A = new int[M][2];
        for(int i = 0; i < M; i++){
            A[i][0] = sc.nextInt();
            A[i][1] = sc.nextInt();
        }
        
        Arrays.sort(A, (a, b) -> Integer.compare(a[1], b[1]) );
        
        int ans = 0;
        for(int i = 0; i < M;){
            
            int right = A[i][1];
            ans++;

            i++;
            while( i < M && A[i][0] < right ){
                i++;
            }
        }
        
        System.out.println(ans);
        
    }
}


Measured memory_bytes: 95184
#include "bits/stdc++.h"
#define rep(i,a,n) for(int i = (a);i < (n);i++)
typedef unsigned long long ull;
typedef long long ll;
using namespace std;


int main(){
	ull n,cnt_march[5] = {0},ans = 0;
	cin >> n;
	string s[n];
	
	rep(i,0,5){
		cnt_march[i] = 0;
	}
	
	
	rep(i,0,n){
		cin >> s[i];
		switch(s[i][0]){
			case 'M':
				cnt_march[0]++;
				break;
			case 'A':
				cnt_march[1]++;
				break;
			case 'R':
				cnt_march[2]++;
				break;
			case 'C':
				cnt_march[3]++;
				break;
			case 'H':
				cnt_march[4]++;
				break;
		}
	}
	
	
	rep(i,0,5){
		rep(j,i+1,5){
			rep(k,j+1,5){
				ans += cnt_march[i]*cnt_march[j]*cnt_march[k];
			}
		}
	}
	
	cout << ans << endl;
	return 0;
}

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

void a()
{
    string s;
    cin >> s;
    s = s.substr(0, s.size() - 8);
    cout << s << endl;
    return;
}

void b()
{
}

void c()
{
}

void d()
{

}

int main() {
    a();
    return 0;
}


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

#define ll long long
#define ull unsigned long long
#define pb push_back
#define pf push_front
#define pof pop_front
#define pob pop_back
#define mp make_pair
#define pll pair<ll,ll>
#define pii pair<int,int>
#define all(s) s.begin(),s.end()
#define vll vector<ll>
#define vi vector<int>
#define vpii vector<pii>
#define vpll vector<pll>
#define vd vector<double>
#define vull vector<ull>
#define vc vector<char>
#define vs vector<string>
#define fi first
#define se second
#define sz(x) x.size()
#define cinarr(n,a) for(int i = 0; i < n; i++) cin >> a[i];
#define coutarr(n,a) for(int i = 0; i < n; i++) cout << a[i] << (i+1==n?'\n':' ');
#define fori(i,a,b,x) for(int i = a; i <= b; i+=x)
#define ford(i,a,b,x) for(int i = a; i >= b; i-=x)
#define tc int tt; cin >> tt; for(int cs = 1; cs <= tt; cs++)
#define IOS ios_base::sync_with_stdio(0); cin.tie(NULL);
#define ld long double
#define reset(x,y) memset(x,y,sizeof x);
#define sqr(x) 1LL*(x)*(x)
#define cube(x) 1LL*(x)*(x)*(x)
#define ub(v, a) upper_bound(all(v), a)
#define lb(v, a) lower_bound(all(v), a)
#define EPS 1e-10
#define INF 200000
#define mod 1000000007
#define minof(a) min_element(all(a))
#define maxof(a) max_element(all(a))
#define debug(val) cerr << "The value of " << #val << " is = " << val << endl;
#define testing cerr << "--------------------------\n";

ll dp[1<<15][1005];
ll a[1005],b[1005],mask[1005],n,m;

ll f(ll msk, ll nw) {
	if(nw==m) {
//		debug(nw)
//		debug(m)
		return (msk==(1<<n)-1?0:mod);
	}
//	debug(dp[msk][nw])
	if(dp[msk][nw]!=-1) return dp[msk][nw];
//	debug(msk)
//	debug(nw)
	return dp[msk][nw]=min(f((msk|mask[nw]),nw+1)+a[nw],f(msk,nw+1));
}

int main() {
	IOS
	reset(dp,-1);
	cin>>n>>m;
	for(int i = 0; i < m; i++) {
		cin>>a[i]>>b[i];
		for(int j = 0,x; j < b[i]; j++) {
			cin>>x;
			x--;
			mask[i]|=(1<<x);
		}
	}
	ll res=f(0,0);
	cout<<(res==mod?-1:res)<<endl;
}


Measured memory_bytes: 261020
#pragma GCC optimize("Ofast,inline,unroll-loops,fast-math")
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>
#include <sstream>
#include <bitset>
#include <memory>
#include <string>
#include <vector>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <deque>
#include <algorithm>
#include <random>
#include <iomanip>
using namespace std;


int main(int argc, char *argv[]) {
	int n, k, s;
	cin >> n >> k >> s;
	vector<int> res;
	for (int i = 0; i < k; i++) {
		res.push_back(s);
	}
	while (res.size() < n) {
		if (s == 1000000000)
			res.push_back(s - 1);
		else
			res.push_back(s + 1);
	}
	for (int i = 0; i < n; i++) {
		cout << res[i] << " ";
	}
	cout << endl;
}









Measured memory_bytes: 1784
#include "bits/stdc++.h"
#define rep(i,a,n) for(int i = (a);i < (n);i++)
typedef unsigned long long ull;
typedef long long ll;
using namespace std;

int main(){
	int n,time = 0,memo  = 0;
	cin >> n;
	int c[n-1],s[n-1],f[n-1];
	
	rep(i,0,n-1){
		cin >> c[i] >> s[i] >> f[i];
	}
	
	rep(i,0,n){
		time = 0;
		
		rep(j,i,n-1){
			memo = 0;
			if(time < s[j]){
				time = s[j]+c[j];
			}
			else{
				while(time > s[j]+f[j]*memo){
					memo++;
				}
				time = s[j]+f[j]*memo+c[j];
			}
		}
		cout << time << endl;
	}
	return 0;
}

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

int main() {
	while(1){
		int h,w;
		cin >> h >>w;
		if(h==0 && w==0) break;
		for(int i=0; i<h; i++){
			for(int j=0; j<w; j++){
				if(i==0 || i==h-1) cout << "#";
				else if(j==0 || j==w-1) cout << "#";
				else cout << ".";
			}
			cout << endl;
		}
		cout << endl;
	}
	return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;

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

int main(){
    int T;
    cin >> T;
    for(int i=0;i<T;i++){
        ll A,B,C,D;
        cin >> A >> B >> C >> D;
        if(B>A || B>D){
            cout << "No" << endl;
            continue;
        }
        if(C>=B || A<=C){
            cout << "Yes" << endl;
            continue;
        }
        ll g=gcd(B,D);
        if((A-C)/g-(A-B)/g > 1 || ((A-C)/g-(A-B)/g==1) && (A-C)%g!=0){
            cout << "No" << endl;
            continue;
        }else{
            cout << "Yes" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <unordered_map>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef pair<int, P> Pi;
ll a[100002], b[100002];
int par[100002];
int rk[100002];
ll size[100002];
ll mx[100002];
int num[100002];
int c;
P pab[200002];
vector<int> v[200002];
void add(int x, int y){
  //v[x].push_back(y);
  v[y].push_back(x);
}
void init(int n){
	for(int i=0; i<n; i++){
		par[i]=i;
		rk[i]=0;
      size[i]=b[i];
      mx[i]=a[i];
      num[i]=i;
	}
}
 
int find(int x){
	if(par[x]==x){
		return x;
	}else{
		return par[x]=find(par[x]);
	}
}
 
void unite(int x, int y){
	x=find(x);
	y=find(y);
	if(x==y) return;
	if(rk[x]<rk[y]){
		par[x]=y;
      add(num[x], c);
      add(num[y], c);
      num[y]=c;
      size[y]+=size[x];
      mx[y]=max(mx[y], mx[x]);
      pab[c]=P(mx[y], size[y]);
	}else{
		par[y]=x;
      add(num[x], c);
      add(num[y], c);
      num[x]=c;
      size[x]+=size[y];
      mx[x]=max(mx[y], mx[x]);
      pab[c]=P(mx[x], size[x]);
		if(rk[x]==rk[y]) rk[x]++;
	}
  c++;
}
 
bool same(int x, int y){
	return find(x)==find(y);
}
ll x0;
//bool used0[200002];
bool dfs(int x){
  //used0[x]=1;
  if(v[x].empty()) return true;
  bool ok=0;
  for(auto y:v[x]){
    //if(used0[y]) continue;
    if(!dfs(y)) continue;
    if(x0+pab[y].second>=pab[x].first){
      ok=1;
    }
  }
  return ok;
}
int main()
{
	int n, m;
  cin>>n>>m;
  c=n;
  P pa[100000];
  ll s=0;
  for(int i=0; i<n; i++){
    cin>>a[i]>>b[i];
    a[i]-=b[i];
    s+=b[i];
    pa[i]=P(a[i], i);
    pab[i]=P(a[i], b[i]);
  }
  if(n==1){
    if(a[0]>=0) cout<<a[0]+b[0]<<endl;
    else cout<<b[0]<<endl;
    return 0;
  }
  sort(pa, pa+n);
  vector<int> g[100000];
  for(int i=0; i<m; i++){
    int u, v;
    cin>>u>>v;
    u--; v--;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  bool used[100000]={};
  init(n);
  for(int i=0; i<n; i++){
    int x=pa[i].second;
    used[x]=1;
    for(auto y:g[x]){
      if(used[y]){
        if(!same(x, y)) unite(x, y);
      }
    }
  }
  /*for(int i=0; i<c; i++){
    cout<<i<<" ";
    for(auto y:v[i]) cout<<y<<" ";
    cout<<endl;
  }*/
  ll x1=0, x2=1e9;
  while(x1!=x2){
    x0=(x1+x2)/2;
    if(dfs(c-1)) x2=x0;
    else x1=x0+1;
  }
  cout<<x1+s<<endl;
	return 0;
}

Measured memory_bytes: 28412
import std.stdio, std.conv, std.string, std.range, std.algorithm, std.range;

void main() {
  auto input = readln.split.to!(int[]);
  auto K = input[0];
  auto X = input[1];

  auto m = max(-100_0000, X - (K - 1));
  auto M = min(X + (K - 1), 100_0000);

  for(int i = m; i <= M; i++) {
    write(i, " ");
  }
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <vector>
#define N 100100
#define pii pair<ll, int>
using namespace std;
typedef long long ll;

int n, sz[N], fa[N];
pii p[N];
vector<int> G[N];

void dfs(int u, int d, ll &res) {
    res += d;
    for (auto v : G[u])
        dfs(v, d + 1, res);
}

int main() {
#ifdef isLOCAL
    freopen("work.in", "r", stdin);
    freopen("work.out", "w", stdout);
#endif

    cin >> n;

    for (int i = 1; i <= n; ++i) {
        long long d;
        scanf("%lld", &d);
        p[i] = make_pair(d, i);
    }

    sort(p + 1, p + n + 1);

    for (int i = n; i > 1; --i) {
        int u = p[i].second, szp;
        ++sz[u], szp = n - sz[u];
        ll tmp = p[i].first + n - 2 * szp;
        int pos = lower_bound(p + 1, p + n + 1, make_pair(tmp, 0)) - p;
        pii now = p[pos];
        if (pos >= i || now.first != tmp) return puts("-1"), 0;
        sz[fa[u] = now.second] += sz[u];
        G[fa[u]].push_back(u);
    }

    int rt = p[1].second;
    ll tmp = 0;
    dfs(rt, 0, tmp);
    if (tmp != p[1].first) return puts("-1"), 0;

    for (int i = n; i > 1; --i)
        printf("%d %d\n", p[i].second, fa[p[i].second]);

    return 0;
}


Measured memory_bytes: 11520
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;

//using Graph = vector<vector<edge>>;
using dou =long double;
string yes="yes";
string Yes="Yes";
string YES="YES";
string no="no";
string No="No";
string NO="NO";

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; }
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(ll i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(ll i = m; i < (ll)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#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 query int qq;std::cin >> qq;rep(qqq,qq)
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum(a) accumulate(all(a),0ll)
#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<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
#define case std::cout <<"Case #" <<qqq+1<<": "
#define RES(a,i,j) a.resize(i);rep(ii,i)a[ii].resize(j); 
#define as assign
#define ffor for(;;)
#define ppri(a,b) std::cout << a<<" "<<b << std::endl
#define pppri(a,b,c) std::cout<<a<<" "<<b<<" "<<c<<std::endl
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define ssum(a) accumulate(a,0ll) 
#define gre(n) greater<n>()

typedef long long ll;
//
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
//typedef long long T;
const int INF = 1000000000;
const double dINF = 1000000000;
const ll INF64 = 922337203685477580ll;
const ll MOD = 1000000007ll;
//const ll MOD = 998244353ll;
const dou pi=3.141592653589793;

//メモ
//二次元配列のresizeのしかた
//vv.resize(n);
//for(size_t i=0; i<n; i++){
// vv[i].resize(n);
//}

//メモ
//負の辺を持つ最短経路問題では到達不可経路でも初期化値より小さくなりうるので注意しよう

int main(){
    string s,t;
    std::cin >> s>>t;
    t.pop_back();
    if(s==t)std::cout << Yes << std::endl;
    else std::cout << No << std::endl;
}


Measured memory_bytes: 3640
fun main(args: Array<String>) {
    val n = readLine()?.toInt() ?: return
    val aList = readLine()?.split(" ")?.map { it.toLong() } ?: return

    if (aList.sum() % 2 == 0L) {
        println("YES")
    } else {
        println("NO")
    }
}

Measured memory_bytes: 53640
INF = 1 << 30
H, W = map(int, raw_input().split())
G = [map(int, list(raw_input())) for _ in xrange(H)]
dp = [[0] * W + [INF] for _ in xrange(H)] + [[0] + [INF] * W]
for y in xrange(H):
    for x in xrange(W):
            dp[y][x] = min(dp[y-1][x], dp[y][x-1]) + G[y][x]
print dp[H-1][W-1]

Measured memory_bytes: 4296
# include<bits/stdc++.h>
using namespace std;
# define lowbit(x) ((x)&(-x))
# define pi acos(-1.0)
# define eps 1e-8
# define MOD 1000000007
# define INF 1000000000
# define mem(a,b) memset(a,b,sizeof(a))
# define FOR(i,a,n) for(register int i=a; i<=n; ++i)
# define FDR(i,a,n) for(register int i=a; i>=n; --i)
# define bug puts("H");
# define lch p<<1,l,mid
# define rch p<<1|1,mid+1,r
# define mp make_pair
# define pb push_back
typedef pair<int,int> PII;
typedef vector<int> VI;
# pragma comment(linker, "/STACK:1024000000,1024000000")
typedef long long LL;
inline char nc(){
    static char buf[1000000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,1000000,stdin),p1==p2)?EOF:*p1++;
}
inline int Scan(){
    char ch=nc();int sum=0, f=1;
    if (ch=='-') f=-1, ch=nc();
    while(!(ch>='0'&&ch<='9'))ch=nc();
    while(ch>='0'&&ch<='9')sum=sum*10+ch-48,ch=nc();
    return sum*f;
}
const int N=300005;
//Code beg....

int main ()
{
    int a, b, c;
    scanf("%d%d%d",&a,&b,&c);
    if (a!=b&&a!=c) printf("%d\n",a);
    else if (b!=a&&b!=c) printf("%d\n",b);
    else printf("%d\n",c);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"

#define MOD 1e9+7
#define PI acos(-1.0)
#define ll long long

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

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

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  string s,t;cin>>s>>t;
  string ans="No";
  sort(s.begin(),s.end());
  sort(t.begin(),t.end());
  reverse(t.begin(),t.end());
  if(s<t)ans="Yes";
  P(ans);
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<vector>
#include<queue>
#include<utility>
#define MAX_V 262144
typedef long long ll;
using namespace std;

int bit[MAX_V+1],n,cnt;

int sum(int i){
    int s=0;
    while(i>0){
        s+=bit[i];
        i-=(i&-i);
    }
    return s;
}

void add(int i,int x){
    while(i<=n+1){
        bit[i]+=x;
        i += i & -i;
        if(i==0){
            break;
        }
    }
}
ll ans=0;
ll suma[200001],a[200000],k;
int main(){
    pair<ll,int> p;
    suma[0]=0;
    priority_queue<pair<ll,int> > q;
    scanf("%d %lld",&n,&k);
    q.push(make_pair(0,0));
    for(int i=0;i<n;i++){
        scanf("%lld",&a[i]);
        a[i]-=k;
        suma[i+1]=suma[i]+a[i];
        q.push(make_pair(suma[i+1],i+1));
    }
    while(!q.empty()){
        p=q.top();
        q.pop();
        ans+=sum(n+1)-sum(p.second+1);
        add(p.second+1,1);
    }
    printf("%lld\n",ans);
}

Measured memory_bytes: 9968
import java.util.*;

public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int sx = sc.nextInt();
        int sy = sc.nextInt();
        int tx = sc.nextInt();
        int ty = sc.nextInt();
        int nowX = sx;
        int nowY = sy;
        char next;
        
        for(int i=0; i<((tx-sx)+(ty-sy))*2; i++){
            if(nowX < tx && nowY == sy){
                System.out.print('R');
                nowX++;
            }else if(nowX == tx && nowY < ty){
                System.out.print('U');
                nowY++;
            }else if(nowY == ty && nowX > sx){
                System.out.print('L');
                nowX--;
            }else if(nowX == sx && nowY > sy){
                System.out.print('D');
                nowY--;
            }
        }
        System.out.print('D');
        nowY--;
        for(int i=0; i<tx-sx+1; i++){
            System.out.print('R');
            nowX++;
        }
        for(int i=0; i<ty-sy+1; i++){
            System.out.print('U');
            nowY++;
        }
        System.out.print('L');
        nowX--;
        System.out.print('U');
        nowY++;
        for(int i=0; i<tx-sx+1; i++){
            System.out.print('L');
            nowX--;
        }
        for(int i=0; i<ty-sy+1; i++){
            System.out.print('D');
            nowY--;
        }
        System.out.println('R');
        nowX++;       
    }
}

Measured memory_bytes: 24324
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N; cin >> N;
	vector<int>a(3 * N); rep(i, 0, 3 * N)cin >> a[i];
	sort(all(a));
	int ans(0);
	int l = 0, r = 3 * N - 1;
	while (N--) {
		l++;
		r--;
		ans += a[r];
		r--;
		dump(l, r, a[r]);
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

struct Node {
	set<int> children;
	int height = -1;
};

vector<Node> tree;

void fix(int node, int parent) {
	tree[node].children.erase(parent);

	for(int child : tree[node].children) {
		fix(child, node);
	}
}

int fill_height(int node) {
	int height = 0;
	for(int child : tree[node].children) {
		height = max(height, fill_height(child));
	}
	height++;

	tree[node].height = height;
	return height;
}

int get_diameter(int node) {
	int diameter = 0;
	vector<int> ch;
	for(int child : tree[node].children) {
		ch.push_back(tree[child].height);
	}

	sort(ch.rbegin(), ch.rend());

	if(ch.size() >= 2) {
		diameter = ch[0] + ch[1];
	}
	else if(ch.size() >= 1) {
		diameter = ch[0];
	}

	for(int child : tree[node].children) {
		diameter = max(diameter, get_diameter(child));
	}

	return diameter;
}

int n;

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

	cin >> n;

	tree = vector<Node>(n);
	for(int i = 0; i < n-1; i++) {
		int a, b;
		cin >> a >> b;

		a--;
		b--;

		tree[a].children.insert(b);
		tree[b].children.insert(a);
	}

	fix(0, -1);
	fill_height(0);
	int dia = get_diameter(0);

	if(dia % 3 == 1) {
		cout << "Second" << endl;
	}
	else {
		cout << "First" << endl;
	}

	return 0;
}


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

const int N = 10000005;

int n;
int d[N];

void sieve() {
  for (int i = 0; i < N; ++i) {
    d[i] = 1;
  }

  for (int i = 2; i < N; ++i) {
    if (d[i] > 1) continue;
    for (int j = i; j < N; j += i) {
      int e = 0;
      int num = j;

      do {
        ++e;
        num /= i;
      } while (num % i == 0);

      d[j] *= (e + 1);
    }
  }
}

int solve() {
  sieve();
  scanf("%d", &n);

  long long ans = 0;
  for (int i = 1; i <= n; ++i) {
    ans += 1LL * i * d[i];
  }
  printf("%lld\n", ans);
  return 0;
}

int main() {
  int t = 1;
  // scanf("%d", &t);
  while (t--) solve();
  return 0;
}


Measured memory_bytes: 42872
#include <iostream>
#include <cstdio>

// x = (e * c - b * f) / (a * e - b * d)
// y = (a * f - d * c) / (a * e - b * d)

using namespace std;

int main() {
    double a, b, c, d, e, f;

    while (cin >> a >> b >> c >> d >> e >> f) {
        int det = a * e - b * d;
        double x = (e * c - b * f) / det + 0.0;
        double y = (a * f - d * c) / det + 0.0;
        printf("%.3f %.3f\n", x, y);
    }

    return 0;
}

Measured memory_bytes: 1236
#include<iostream>
using namespace std;
int main(){
	int a,b,temp;
	for(;;){
		cin >> a >> b;
		if(a==0&&b==0) break;
		if(a>b){			//swap
			temp=a;
			a=b;
			b=temp;
		}
		cout<< a << " " << b << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
N,K = map(int, raw_input().split(" "))

points = []
pointsx = []
pointsy = []

smin = 0

for i in range(N):
    x,y = map(int, raw_input().split(" "))
    pointsx.append(x)
    pointsy.append(y)

spx = sorted(pointsx)

for i in range(N-K+1):
    for h in range(N-K-i+1):
        yneed = []
        for k in range(N):
            if pointsx[k]>=spx[i] and pointsx[k]<=spx[i+K+h-1]:
                yneed.append(pointsy[k])
        spy = sorted(yneed)
        ylength = 0
        xlength = spx[i+K+h-1]-spx[i]
        for k in range(len(spy) - K + 1):
            if ylength == 0: ylength = spy[k+K-1]-spy[k]
            elif ylength > spy[k+K-1]-spy[k]: ylength = spy[k+K-1]-spy[k]
        if smin == 0: smin = ylength * xlength
        elif smin > ylength * xlength:
            smin = ylength * xlength


print smin


Measured memory_bytes: 2696
#[allow(unused_imports)]
use std::cmp;
use std::io::Write;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    let s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

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

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

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

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

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

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

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

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

fn main() {
  let out = std::io::stdout();
  let mut out = std::io::BufWriter::new(out.lock());
  macro_rules! puts {
    ($($format:tt)*) => (write!(out,$($format)*).unwrap());
  }
  input! {
    n: usize,
    k: i64,
    aa: [i64; n],
    ff: [i64; n],
  }
  let mut aa = aa;
  aa.sort();
  let mut ff = ff;
  ff.sort();
  ff.reverse();
  let mut l = -1;
  let mut r = 1e15 as i64;
  while l + 1 < r {
    let m = (l + r) / 2;
    let mut train = 0;
    for (&a, &f) in aa.iter().zip(ff.iter()) {
      let b = m / f;
      train += cmp::max(0, a - b);
    }
    if train <= k {
      r = m;
    } else {
      l = m;
    }
  }

  puts!("{}\n", r);
}


Measured memory_bytes: 14072
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
   int N, a;
   cin >> N;
   vector<int> As(N);
   for(int i = 0; i < N; ++i){
       cin >> a;
       As[i] = a;
   }
    int zeroCount = 0;
    int i = 0;
    while(true){
        if(i == N) i = 0;
        if(As[i] != 0){
            for(int j = 0; j < N; ++j){
                if(i == j || As[j] == 0) continue;
                As[j] %= As[i];
                if(As[j] == 0) zeroCount++;
            }
            if(zeroCount == N-1){
                cout << As[i] << endl;
                return 0;
            }
        }   
        i++;
    }


    return 0;
}

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

typedef long long ll;

#define rep(var,n) for(int var=0;var<(n);++var)

int main(){

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

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

  ll l[n-1];
  ll r[n-1];
  l[0] = a[0];
  r[0] = a[n-1];
  rep(i,n-2){
    l[i+1] = max(l[i],a[i+1]);
    r[i+1] = max(r[i],a[n-i-2]);
  }
  cout << r[n-2] << endl;
  rep(i,n-2)
    cout << max(l[i],r[n-i-3]) << endl;
  cout << l[n-2] << endl;

  return 0;
}

Measured memory_bytes: 6272
"use strict";

const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0]);
    const MOD = 1e9 + 7;
    
    let cnt = [...Array(N + 1)].fill(0);
    
    for(let i=1; i<=N; i++) {
        let b = i;
        
        for(let j=2; j<=N; j++) {            
            while(b % j === 0) {
                b /= j;
                cnt[j]++;
            }
        }
    }
    
    let answer = 1;
    
    for(let i=2; i<=N; i++) {
        answer = answer * (cnt[i] + 1) % MOD;
    }
    
    console.log(answer);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 7604
use std::io;
use std::str::FromStr;

fn main() {
    let stdin = io::stdin();
    let mut buf = String::new();
    stdin.read_line(&mut buf).ok();
		let mut iter = buf.split_whitespace();
		let n : i32 = iter.next().unwrap().parse().unwrap();
		
		if n >= 1000 {
			println!("ABD");
		}
		else{
			println!("ABC");
		}
}

Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include <bits/stdc++.h>
#include <utility>
#include <iomanip>

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<30)

using namespace std;

#define ld long double
#define ll long long

map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int N,M;
  cin >> N >> M;
  int C[40]={0};
  for(int i=1;i<=N;i++){
    int K;
    cin >> K;
    for(int j=0;j<K;j++){
      int A;
      cin >> A;
      C[A]++;
    }
  }
  int ans=0;
  for(int i=0;i<40;i++){
    if(C[i]==N){
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

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

using namespace std;

const long long MOD = 1000000007LL;
long long GCD(long long a, long long b){return b == 0 ? a : GCD(b, a % b);}

vector<long long> psa;
map<long long, long long> cnt;

int main(){

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

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int n;
    cin >> n;

    psa.push_back(0LL);
    cnt.insert({0, 1});

    for(int i = 0; i < n; ++i){
        long long j;
        cin >> j;
        psa.push_back(psa[psa.size() - 1] + j);
        if(cnt.find(psa[psa.size() - 1]) == cnt.end()){
            cnt.insert({psa[psa.size() - 1], 1LL});
        } else {
            cnt[psa[psa.size() - 1]]++;
        }
    }

    long long tot = 0;

    for(auto i : cnt){
        tot += i.second * (i.second - 1) >> 1;
    }

    cout << tot;


    return 0;
}


Measured memory_bytes: 14320
main :: IO ()
main = do
    [a,b,c,d] <- getInts
    print $ solve a b c d

getInts :: IO [Int]
getInts = map read . words <$> getLine

solve :: Int -> Int -> Int -> Int -> Int
solve a b c d
    | a <= c && d <= b = d - c
    | a <= c && c <= b = b - c
    | c <= a && b <= d = b - a
    | c <= a && a <= d = d - a
    | otherwise = 0


Measured memory_bytes: 508
#include<iostream>

int main()
{
    int a, b, c, J, count=0;
    int *div = new int[5000];
    double _c;

    std::cin>>a>>b>>c;

    if (b<a) 
    {
        std::cout<<"Wrong Number!\a"<<std::endl;
        return -1;
    }
    if ((a<1&100<a)&(b<1&100<b)&(c<1&100<c)) {
        std::cout<<"Wrong Number?\a"<<std::endl;
        return -1;
    }


    for(int i = 1; i <= c; i++)
    {
        _c = (double)c/i;
        J = c/i;
        if((J==_c)&(a<=_c&_c<=b))
        {
            count += 1;
        }
    }   

    /*else
    {
        count = 1;
    }*/
    
    std::cout<<count<<std::endl;
    
    return 0;
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) begin(x), end(x)
using namespace std;
using ll = long long;
constexpr ll Mod = 998244353;
constexpr ll mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;
const double PI = acos(-1);
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) {
    return a < b && (a = b, true);
}
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) {
    return a > b && (a = b, true);
}
/*-------------------------------------------*/

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

    ll d, t, s;
    cin >> d >> t >> s;

    cout << (s * t < d ? "No" : "Yes");

    return 0;
}

Measured memory_bytes: 3648
#include<stdio.h>
int main()
{
	int a,b;
	scanf("%d %d",&a,&b);
	int d,r;
	double f,a1,b1;
	a1=a;
	b1=b;
	d=a/b;
	r=a%b;
	f=a1/b1;
	printf("%d %d %lf",d,r,f);
	printf("\n");
	return 0;
} 


Measured memory_bytes: 2708
my ($num,$len) = split(/ /,<STDIN>);

my @input;
for(my $i = 0; $i < $num; ++$i){
    push(@input,<STDIN>);
}
chomp(@input);
print &min_str(@input);

sub min_str{
	my @ary = @_;
	@ary = sort {$a cmp $b} @ary;
	my $ret_str;
	foreach $s (@ary){
		$ret_str .= $s;
	}
	return $ret_str;
}

Measured memory_bytes: 512
package main

import "fmt"

func main() {
  var n, k int
  fmt.Scan(&n, &k)
  var s string
  fmt.Scan(&s)

  var list []int
  now, count := 1, 0
  for _, v := range s {
    if v == rune('0'+now) {
      count++
    } else {
      list = append(list, count)
      now = 1 - now
      count = 1
    }
  }
  if count != 0 {
    list = append(list, count)
  }
  if len(list)%2 == 0 {
    list = append(list, 0)
  }

  listRange := 2*k + 1
  var left, right, tmp, ans int
  for i := 0; i < len(list); i += 2 {
    leftEdge := i
    rightEdge := getMin(i+listRange, len(list))

    for left < leftEdge {
      tmp -= list[left]
      left++
    }
    for right < rightEdge {
      tmp += list[right]
      right++
    }
    ans = getMax(tmp, ans)
  }
  fmt.Println(ans)
}

func getMin(a int, b int) int {
  if a > b {
    return b
  }
  return a
}

func getMax(a int, b int) int {
  if getMin(a, b) == a {
    return b
  }
  return a
}

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

const int Inf = 0x7fffffff;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;

VVI P, DP;

int f(int d, int X) {
    int& res = DP[d][X];
    if (res != -1) return res;
    if (d == 0) {
        int mx = -Inf;
        for (int i = 0; i < 3; ++i)
            if (i != X and P[d][i] > mx) mx = P[d][i];
        return res = mx;
    }
    int mx = -Inf;
    for (int i = 0; i < 3; ++i) {
        if (i != X) mx = max(mx, P[d][i] + f(d-1, i));
    }
    return res = mx;
}

int main() {
    int N;
    cin >> N;
    P = VVI(N, VI(3));
    DP = VVI(N, VI(3, -1));
    for (int i = 0; i < N; ++i) {
        cin >> P[i][0] >> P[i][1] >> P[i][2];
    }
    cout << max(f(N-1, 0), max(f(N-1, 1), f(N-1, 2))) << endl;
}


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

int main(){
    int a, b, x;
    cin >> a >> b >> x;

    int ans = 0;
    if(a <= b){
        ans = (x+999)/1000 * a;
    }else if(2*b < a){
        ans = (x+499)/500 * b;
    }else{
        ans = x/1000 * a;
        x %= 1000;
        ans += min(a, (x+499)/500*b);
    }

    cout << ans << endl;

    return 0;
}


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

using namespace std;
#define int long long
int MOD = 1000000007;

signed main(){
    int a,b;
    cin >> a >> b;
    
    if(a<=0 && b>=0) cout << "Zero" << endl;
    else if(a>0) cout << "Positive" << endl;
    else if(b<0 && (b-a)%2!=0) cout << "Positive" << endl;
    else cout << "Negative" << endl;
    
    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

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

int main(void)
{
	int a, b;
	
	while (scanf("%d %d", &a, &b) != EOF){
		printf("%d\n", gcd(a, b));
	}
	
	return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define each(it,v) for(auto &it : v)
#define mod 1000000007
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define vl vector<long>
#define P pair<int,int>
using namespace std;

main()
{
        int a,b,h; cin>>a>>b>>h;
        cout<<(a+b)*h/2<<endl;
}

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 x, y;
    cin >> x >> y;
    bool ok = false;
    for(int i = 0; i <= x; i++){
        if (2*i + 4*(x-i) == y){
            ok = true;
          	cout << "Yes" << endl;
            break;
        }
    }
    if(!ok) cout << "No" << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int,int>;
const long long inf = 1000000001; // const 書き換え禁止
const double PI = 3.14159265358979323846; //M_PI はライブラリ

int main(void){
    int a,b,c;
    vector<int> vec(3);
    rep(i,3){
        cin >> vec.at(i);
    }
    sort(vec.begin(),vec.end());
    reverse(vec.begin(),vec.end());
    int ans = vec.at(0) * 10 + vec.at(1);
    ans += vec.at(2);
    cout << ans << endl;

}

Measured memory_bytes: 3628
#include <stdio.h>

int n, q;
int A[20];
int m[200];

int dfs(int i, int m)
{
  if (i == n)  return (m == 0);
  else if (dfs(i + 1, m))  return 1;
  else if (dfs(i + 1, m - A[i]))  return 1;
  else return 0;
}
	   
int main()
{
  scanf("%d", &n);
  for (int i = 0; i < n; i++)
    scanf("%d", &A[i]);
  scanf("%d", &q);
  for (int i = 0; i < q; i++) {
    scanf("%d", &m[i]);
    if (dfs(0, m[i]))  puts("yes");
    else  puts("no");
  }

  return 0;
}



Measured memory_bytes: 2144
import sys
import math
import fractions
from collections import deque
from collections import defaultdict

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]


# Nの素因数分解を辞書で返す
def prime_fact(n, ela):
    if n == 1:
        return {1: 1}


    prime_dict = {}
    for i in ela:
        cnt = 0
        while n % i == 0:
            cnt += 1
            n = n // i
        if cnt:
            prime_dict[i] = cnt
        if n == 1:
            break
    if n != 1:
        prime_dict[n] = 1
    return prime_dict


def sieve_of_erastosthenes(num):
    input_list = [False if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else True for i in range(num)]
    input_list[0] = input_list[1] = False
    input_list[2] = input_list[3] = input_list[5] = True
    sqrt = math.sqrt(num)

    for serial in range(3, num, 2):
        if not input_list[serial]:
            continue

        if serial >= sqrt:
            return input_list

        for s in range(serial ** 2, num, serial):
            input_list[s] = False


def main():
    N = NI()
    A = NLI()
    ela = sieve_of_erastosthenes(1001)
    ela2 = [i for i, b in enumerate(ela) if b]

    if max(A) == 1:
        print("pairwise coprime")
        exit()

    g = A[0]
    for a in A:
        g = math.gcd(g, a)
    if g > 1:
        print("not coprime")
        exit()

    SA = set(A)
    SA.discard(1)
    if len(SA) >= 90000:
        print("setwise coprime")
        exit()

    p_cnt = defaultdict(int)
    PD_list = defaultdict(dict)
    cnt = 0
    for a in A:
        if a == 1:
            continue

        if PD_list[a]:
            AP = PD_list[a]
        else:
            AP = prime_fact(a, ela2)
            PD_list[a] = AP
        for apk in AP.keys():
            p_cnt[apk] += 1

    max_p = max(p_cnt.values())
    if max_p == 1:
        print("pairwise coprime")
    elif max_p == N:
        print("not coprime")
    else:
        print("setwise coprime")



if __name__ == "__main__":
    main()

Measured memory_bytes: 231396
n = int(input())

if n > 81:
    print("No")

elif n%2 == 0:
    if n%8 == 0:
        if n//8 < 10:
            print("Yes")
        else:
            print("No")
    elif n%6 == 0:
        if n//6 < 10:
            print("Yes")
        else:
            print("No")
    elif n%4 == 0:
        if n//4 < 10:
            print("Yes")
        else:
            print("No")
    else:
        if n//2 < 10:
            print("Yes")
        else:
            print("No")

elif n%3 == 0:
    if n%9 == 0:
        if n//9 < 10:
            print("Yes")
        else:
            print("No")
    else:
        if n//3 < 10:
            print("Yes")
        else:
            print("No")

elif n%5 == 0:
    if n//5 < 10:
        print("Yes")
    else:
        print("No")

elif n%7 == 0:
    if n//7 < 10:
        print("Yes")
    else:
        print("No")

else:
    if n < 10:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 3064
//=============================================================
// Name        : c
// Date        : Mon Jun 10 10:19:03 CST 2019
// Author      : landcold7
// Description : Actions speak louder more than words
//=============================================================
#include <bits/stdc++.h>
using namespace std;

#define x first
#define y second
#define sz(x) ((int)(x).size())
#ifndef _has_trace
#define trace(...)
#endif
typedef long long ll;

void solve() {
  int n, m;
  cin >> n >> m;
  vector<int> was(n + 1);
  for (int i = 0; i < m; ++i) {
    int x;
    cin >> x;
    was[x] = 1;
  }
  const int mod = 1e9 + 7;
  vector<int> dp(n + 1);
  dp[0] = 1;
  for (int i = 1; i <= n; ++i) {
    if (was[i]) {
      dp[i] = 0;
    } else {
      dp[i] += dp[i - 1] % mod;
      if (i >= 2) {
        dp[i] += dp[i - 2] % mod;
      }
      dp[i] %= mod;
    }
  }
  trace(was, dp);
  cout << dp[n] << "\n";
}

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
  return 0;
}


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

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

    int min=101;
    int sum=0;
    for(int i=0; i<n; i++) {
        if(s[i]%10!=0 && min>s[i]) min = s[i];
        sum+=s[i];
    }


    if(min==101) cout << '0' << endl;
    else if(sum%10==0) cout << sum - min << endl;
    else cout << sum << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>/
// #include <ext/pb_ds/tree_policy.hpp>

#define pb push_back
#define mp make_pair

#define mod 998244353LL
#define IN freopen("input.txt","r",stdin)
#define OUT freopen("output.txt","w",stdout)
#define FOR(i,a,b) for(i=a ; i<=b ; i++)
#define DBG printf("Hi\n")
#define INF 2000000000000000000LL
#define i64 long long int
#define eps (1e-8)
#define xx first
#define yy second
#define ln 17
#define off 2
#define SZ(z) ((int)z.size())
#define sq(x) ((x)*(x))

#define FastIO ios_base::sync_with_stdio(false); cin.tie(NULL)

#define EPS 1e-7

// using namespace __gnu_pbds;
using namespace std ;

// typedef tree< i64, null_type, less<i64>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

typedef long double T ;

const T PI = ( acosl(-1.0) ) ;

#define maxn 200005
#define R 0
#define B 1
#define G 2
#define RB 0
#define RG 1
#define BG 2

char s[3*maxn] ;

i64 dbl[3] , sing[3] ;

int main()
{
    int n ;
    scanf("%d",&n) ;
    scanf("%s",s) ;

    i64 ans = 1LL ;

    for(int i=0 ; i<3*n ; i++)
    {
        if( s[i]=='G' )
        {
            if(dbl[RB] > 0  )
            {
                ans = (ans*dbl[RB])%mod ;
                dbl[RB]-- ;
            }
            else if( sing[R] )
            {
                ans = (ans*sing[R])%mod ;
                sing[R]-- ;
                dbl[RG]++ ;
            }
            else if( sing[B] )
            {
                ans = (ans*sing[B])%mod ;
                sing[B]--;
                dbl[BG]++ ;
            }
            else sing[G]++ ;
        }
        if( s[i]=='B' )
        {
            if(dbl[RG] > 0  )
            {
                ans = (ans*dbl[RG])%mod ;
                dbl[RG]-- ;
            }
            else if( sing[R] )
            {
                ans = (ans*sing[R])%mod ;
                sing[R]-- ;
                dbl[RB]++ ;
            }
            else if( sing[G] )
            {
                ans = (ans*sing[G])%mod ;
                sing[G]--;
                dbl[BG]++ ;
            }
            else sing[B]++ ;
        }
        if( s[i]=='R' )
        {
            if(dbl[BG] > 0  )
            {
                ans = (ans*dbl[BG])%mod ;
                dbl[BG]-- ;
            }
            else if( sing[G] )
            {
                ans = (ans*sing[G])%mod ;
                sing[G]-- ;
                dbl[RG]++ ;
            }
            else if( sing[B] )
            {
                ans = (ans*sing[B])%mod ;
                sing[B]--;
                dbl[RB]++ ;
            }
            else sing[R]++ ;
        }
    }

    for(int i=1 ; i<=n ; i++)
    {
        ans = (1LL*ans*i)%mod ;
    }

    printf("%lld\n",ans) ;

    return 0 ;
}


Measured memory_bytes: 512
let () =
  let ts = Array.init 5 @@ fun _ -> Scanf.scanf " %d" Fun.id in
  let sum = Array.fold_left (fun acc elt -> acc + (elt + 9) / 10 * 10) 0 ts in
  let ans = ( - ) sum @@ Array.fold_left (fun acc elt -> max acc @@ ((elt + 9) / 10 * 10) - elt) 0 ts in
  Printf.printf "%d\n" ans

  

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

int main(){
  int n,s=0;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++){
  	cin>>a[i];
    if(i%2==0)
      if(a[i]%2==1)
        s++;
  }
  cout<<s<<endl;
  return 0;
}

Measured memory_bytes: 3636
while True:
    m, f, r = map(int, input().split())

    if m == f == r == -1:
        break

    if m == -1 or f == -1:
        print('F')
    elif m+f >= 80:
        print('A')
    elif 80 > m+f >= 65:
        print('B')
    elif 65 > m+f >= 50:
        print('C')
    elif 50 > m+f >= 30:
        if r >= 50:
            print('C')
        else:
            print('D')
    else:
        print('F')



Measured memory_bytes: 5596
#include <cstdio>
#define ll long long

#define mx 200005
int n,k;
ll A[mx];

bool doable(ll target){
    ll tot=0; 
    for(int i=0;i<n;i++){
        tot+=(A[i]%target==0 ? A[i]/target - 1 : A[i]/target);
    }
    return tot<=k;
}

int main(){
    scanf("%d %d",&n,&k);

    for(int i=0;i<n;i++) scanf("%lld",A+i);

    int l=0,r=1e9+5;

    while(r-l>1){
        int mid=(l+r)/2;
        if(doable(mid)) r=mid;
        else l=mid;
    }

    printf("%d\n",r);
}


Measured memory_bytes: 3248