akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;

using ll =  long long;
using Pll = pair<ll, ll>;

constexpr ll MOD = 998244353;

template<class T> class SegmentTree {
    public:
    typedef function<T(T, T)> F;
    size_t n;
    vector<T> data;
    T def;  // 単位元
    T initial_value;    // 初期値
    F update_func;  // 更新用関数
    F find_func;  //クエリ用関数

    SegmentTree(size_t _n, T def, T initial_value, F update_func, F find_func)
        : def(def), initial_value(initial_value), update_func(update_func), find_func(find_func) {
        n = 1;
        while(n < _n) n <<= 1;
        data = vector<T>(2*n-1, initial_value);
    }

    void update(size_t i, T x) {
        i += n-1;
        data[i] = update_func(data[i], x);
        while(i) {
            i = (i-1) / 2;
            data[i] = find_func(data[2*i+1], data[2*i+2]);
        }
    }

    T find(size_t s, size_t t, size_t k, size_t kl, size_t kr) {
        if(kr <= s || t <= kl) return initial_value;
        if(s <= kl && kr <= t) return data[k];
        size_t kc = (kl+kr) / 2;
        T vl = find(s, t, 2*k+1, kl, kc);
        T vr = find(s, t, 2*k+2, kc, kr);
        return find_func(vl, vr);
    }

    T find(size_t s, size_t t) {
        return find(s, t, 0, 0, n);
    }
};

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int n;
    cin >> n;
    vector<Pll> robots(n);
    for(int i=0;i<n;++i) cin >> robots[i].first >> robots[i].second;
    sort(robots.begin(), robots.end());
    for(int i=0;i<n;++i) {
        cerr << robots[i].first << " " << robots[i].second << endl;
    }


    // 初めて影響が及ばなくなる idx
    SegmentTree<int> ti(
        n+1, 0, 0, 
        [](ll a, ll b) { return b; },
        [](ll a, ll b) { return max(a, b); }
    );
    ti.find(n, n);
    for(int si=n-1;si>=0;--si) {
        int tmp_ti = int(lower_bound(robots.begin()+si, robots.end(), Pll(robots[si].first + robots[si].second, -1LL)) - robots.begin());
        if(tmp_ti - 1 > si) tmp_ti = ti.find(si+1, tmp_ti);
        ti.update(si, tmp_ti);
    }

    // i 以降を見たとして，最後に起動させたのが i の場合の通り数
    vector<ll> dp(n+1, 0);
    dp[n] = 1;
    for(int si=n-1;si>=0;--si) {
        dp[si] = (dp[ti.find(si, si+1)] + dp[si+1]) % MOD;
    }

    cout << dp[0] << endl;
}


Measured memory_bytes: 7040
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
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 EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
int N;
vector<i_i> paths[105000];
int ans[105000];
int K;

void dfs(int now, int from, int color) {
    for(auto v : paths[now]) {
        int to = v.first;
        int index = v.second;
        if(to == from) continue;
        color = (color + 1) % K;
        ans[index] = color + 1;
        dfs(to, now, color);
    }
}

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    for(int i = 0; i < N - 1; i++) {
        int a, b;
        cin >> a >> b;
        paths[a].push_back({b, i});
        paths[b].push_back({a, i});
    }
    for(int i = 1; i <= N; i++) {
        chmax(K, (int)paths[i].size());
    }
    dfs(1, -1, -1);
    cout << K << endl;
    for(int i = 0; i < N - 1; i++) {
        cout << ans[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 7680
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ppb pop_back()
#define ALL(a) (a).begin(),(a).end()
#define int long long
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;

//有向グラフ上巡回セールスマン問題
//verified
const ll INF=1e18;
signed main(){
    int n,m; cin >> n >> m;
    map<P,ll> mp;
    map<P,bool> ok;
    rep(i,m){
        int s,t; ll d;
        cin >> s >> t >> d;
        //from s to t
        mp[{s,t}]=d;
        ok[{s,t}]=1;
    }
    //dp[S][j]:=Sを通ってラストがjの時の、残りの経路の最短　ans:=dp[0][j] for j in [0,n)
    ll dp[1<<n][n];
    rep(i,1<<n){
        rep(j,n){
            dp[i][j]=INF;
        }
    }
    dp[(1<<n)-1][0]=0;
    rrep(i,(1<<n)){
        rep(j,n){
            rep(k,n){
                if(!ok[{j,k}]) continue;
                if(i&(1<<k)) continue;
                chmin(dp[i][j],dp[i|(1<<k)][k]+mp[{j,k}]);
            }
        }
    }
    ll res=INF;
    chmin(res,dp[0][0]);
    cout << (res==INF ? -1 : res) << endl;
}



Measured memory_bytes: 6972
#include <iostream>
#include <algorithm> 
        using namespace std;
         
        int main(){
          string s,t;
          cin >> s >> t;
          
          sort(s.begin(), s.end());
          sort(t.begin(), t.end());
          reverse(t.begin(), t.end());
          
          if(s<t){
            cout << "Yes" << endl;
          }else{
            cout << "No" << endl;
          }
        }

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	private static final int MAX_CARDS = 52;
	private static final int NUM_SUIT = 4;
	private static final int MAX_CARD_NUMBER = 13;
	
	private static final int SPADE = 0;
	private static final int HEART = 1;
	private static final int CLUB = 2;
	private static final int DIA = 3;
	
	private static final int EXIST = 1;
	private static final int MISSING = 0;
	
	private static Scanner sc = new Scanner(System.in);
	
	private static int numCards = MAX_CARDS;
	private static  int[][] cards = new int[NUM_SUIT][MAX_CARD_NUMBER + 1];
	
	public static void main(String[] args) {
		initializeCardsState();
		numCards = getNumCards();
		checkNumCards(numCards);
		setAllCardsExist();
		printMissingCards();
	}
	
	private static void printMissingCards(){		
		//???????????????????????????????????????
		for(int i = 0; i < NUM_SUIT; i++){
			for(int j = 1; j < MAX_CARD_NUMBER + 1; j++){
				printMissingCard(i, j);
			}
		}
	}
	
	private static void checkNumCards(int n){
		if(!(0 < n && n <= MAX_CARDS )){
			System.out.println("?????????????????§????????¶??°?????\?????????????????????");
			System.exit(0);
		}
	}
	
	private static int getNumCards(){
		int n = 0;
		if(sc.hasNextInt()){
			n = sc.nextInt();
		}
		else{
			System.out.println("?????¶??°??\????????\?????????????????????");
			System.exit(0);
		}
		
		return n;
	}
	
	private static void setCardExist(){
		char suit = 'a';
		int n = 0;
		
		if(sc.hasNext()){
			suit = sc.next().charAt(0);
		}
		
		if(sc.hasNextInt()){
			n = sc.nextInt();
		}
		
		switch(suit){
		case 'S':
			cards[SPADE][n] = EXIST;
			break;
		case 'H':
			cards[HEART][n] = EXIST;
			break;
		case 'C':
			cards[CLUB][n] = EXIST;
			break;
		case 'D':
			cards[DIA][n] = EXIST;
			break;
		default:
			System.out.println("S, H, C, D????????????????????\?????????????????????");
			System.exit(0);
		}
	}
	
	private static void setAllCardsExist(){
		//???????????????????????????card????????§??¨?????????
		int i = 0;
		while(i < numCards){
			//??\????????????????????????????????????????????????
			setCardExist();
			i++;
		}
	}
	
	private static void printMissingCard(int i, int j){
		if(cards[i][j] == EXIST){
			//?????????????????¨????????´???????????????????????????
		}
		else{
			System.out.printf("%s %d\n", getSuit(i), j);
		}
	}
	
	private static void initializeCardsState(){
		for(int i = 0; i < NUM_SUIT; i++){
			for(int j = 0; j < MAX_CARD_NUMBER; j++){
				cards[i][j] = MISSING;
			}
		}
	}
	
	private static char getSuit(int n){
		switch(n){
		case SPADE:
			return 'S';
		case HEART:
			return 'H';
		case CLUB:
			return 'C';
		case DIA: 
			return 'D';
		default:
			return ' ';
		}
	}
}

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

int main() {
	int n, h[25], ans = 1, maxh;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> h[i];
	}
	maxh = h[0];
	for (int i = 1; i < n; i++) {
		if (h[i] >= maxh) {
			ans++;
			maxh = h[i];
		}
	}
	cout << ans << endl;
	return 0;
}

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

int CNT[200001];

long long SUM[200001];

int main() {
	for(int i=1;i<200001;i++)
		SUM[i] = SUM[i-1] + i;

	int N;cin>>N;
	vector<int>A(N);

	long long ans = 0;

	for (int i = 0; i < N; i++)
	{
		cin>>A[i];
		ans += CNT[A[i]];
		CNT[A[i]]++;
	}
	
	for (int i = 0; i < N; i++)
	{
		cout<<ans - (CNT[A[i]]-1)<<endl;
	}

	return 0;
}

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

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

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

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, a, b, c, d;
	cin >> n >> a >> b >> c >> d;
	rep (i, n) {
		if ((c * (n - 1 - i) - d * i) <= b - a && b - a <= (d * (n - 1 - i) - c * i)) {
			cout << "YES\n";
			return 0;
		}
	}
	cout << "NO\n";
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>

int main(void) {
	long long a,b,c;
	scanf("%lld %lld %lld",&a,&b,&c);
	if (c-a-b<0) {
		printf("No");
		return 0;
	}
	if ((c-a-b)*(c-a-b)>4*a*b) {
		printf("Yes");
	}
	else {
		printf("No");
	}
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a,b;
  cin >> a >> b;
  if ((a*b)%2 ==0){
    cout << "Even" <<endl;
  }
  else if ((a*b)%2 == 1){
    cout  << "Odd" <<endl;
  }
}


Measured memory_bytes: 256
#include<cstdio>
using namespace std;
typedef long long LL;
const int N=100005;
struct node { int y,z,next; } a[N<<1];
LL an;
int s[3],head[N],z[N],i,j,k,n,m,S,E;
bool p[N],F;
char c;

inline char getc()
{
	#define VV 10000000
	static char s[VV],*l=s,*r=s;
	if (l==r)
		l=s,r=s+fread(s,1,VV,stdin);
	return l==r?0:*l++;
}

int read(){ int z=0; do c=getc(); while (c<'0'||c>'9'); while (c>='0'&&c<='9') z*=10,z+=c-'0',c=getc(); return z; }

void jb(int y,int x)
{
	a[++k]=(node){y,1,head[x]},head[x]=k,
	a[++k]=(node){x,2,head[y]},head[y]=k;
}

void dfs(int w)
{
	p[w]=1,++s[z[w]],++S;
	for (register int j=head[w];j;j=a[j].next)
	{
		int c=a[j].y;
		if (j&1) ++E;
		if (!p[c])
			z[c]=(z[w]+a[j].z)%3,dfs(c);
		else
			if (z[c]!=(z[w]+a[j].z)%3)
				F=0;
	}
}

int main()
{
	n=read(),m=read();
	while (m--) jb(read(),read());
	for (i=1;i<=n;++i)
		if (!p[i])
		{
			F=1,s[0]=s[1]=s[2]=S=E=0;
			dfs(i);
			if (F)
				if (s[0]&&s[1]&&s[2])
					an+=(LL)s[0]*s[1]+(LL)s[1]*s[2]+(LL)s[2]*s[0];
				else
					an+=E;
			else
				an+=(LL)S*S;
		}
	printf("%lld\n",an);
	return 0;
}

Measured memory_bytes: 9472
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>

#define x first
#define h second

const int MAXN = (int)2e5;

std::pair<int, int> a[MAXN];

// 区间更新，单点查询.
struct SegmentTree {
  static const int NODENUM = MAXN * 8 + 1;
  int64_t lazy[NODENUM];

  SegmentTree() {
    for (int i = 1; i < NODENUM; ++i) {
      lazy[i]= 0;
    } 
  }

  void PushDown(int rt) {
    if (lazy[rt] == 0) return;
    lazy[rt << 1] += lazy[rt];
    lazy[rt << 1 | 1] += lazy[rt];
    lazy[rt] = 0;
  }

  void Update(int ul, int ur, int add_val, int l, int r, int rt) {
    if (ul <= l && ur >= r) {
      lazy[rt] += add_val;
      return;
    }
    int mid = (l + r) / 2;
    PushDown(rt);
    if (ul <= mid) Update(ul, ur, add_val, l, mid, rt << 1);
    if (ur > mid) Update(ul, ur, add_val, mid + 1, r, rt << 1 | 1);
  }

  int64_t Query(int pos, int l, int r, int rt) {
    if (l == r) return lazy[rt];
    PushDown(rt);
    int mid = (l + r) >> 1;
    if (pos <= mid) return Query(pos, l, mid, rt << 1);
    else return Query(pos, mid + 1, r, rt << 1 | 1);
  }
};
SegmentTree seg_tree;

void hash_x(int n, int d, std::vector<int64_t>* for_hash) {
  for (int i = 0; i < n; ++i) {
    for_hash->at(i) = a[i].x;
    for_hash->at(i + n) = (int64_t)a[i].x + 2 * d;
  }
  std::sort(for_hash->begin(), for_hash->end());
  for_hash->erase(std::unique(for_hash->begin(), for_hash->end()), for_hash->end());
}

int hash_find(int64_t v, const std::vector<int64_t>& for_hash) {
  return std::lower_bound(for_hash.begin(), for_hash.end(), v) - for_hash.begin() + 1;
}

int64_t solve(int n, int d, int p) {
  std::sort(a, a + n);
  std::vector<int64_t> for_hash(2 * n);
  hash_x(n, d, &for_hash);

  int64_t ans = 0;
  int seg_len = for_hash.size();
  
  for (int i = 0; i < n; ++i) {
    int x_hash = hash_find(a[i].x, for_hash);
    seg_tree.Update(x_hash, x_hash, a[i].h, 1, seg_len, 1);
    int64_t height = seg_tree.Query(x_hash, 1, seg_len, 1);
    int64_t use_bomb_num = (height + p - 1) / p;
    if (use_bomb_num <= 0) continue;
    ans += use_bomb_num;
    int r_hash = hash_find((int64_t)a[i].x + 2 * d, for_hash);
    seg_tree.Update(x_hash, r_hash, -use_bomb_num * p, 1, seg_len, 1);
  }
  return ans;
}

int main() {
  int n, d, p;
  std::cin >> n >> d >> p;
  for (int i = 0; i < n; ++i) {
    std::cin >> a[i].x >> a[i].h;
  }
  std::cout << solve(n, d, p) << std::endl;
  return 0;
}


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

using namespace std;

int main() {
  string S;
  S.size() == 3;
  cin >> S;
  
  if (S.at(0) == 'A' && S.at(1) == 'A' && S.at(2) == 'A') {
    cout << "No" << endl;
  }
  
  else if (S.at(0) == 'B' && S.at(1) == 'B' && S.at(2) == 'B') {
    cout << "No" << endl;
  }
  
  else if(S.at(0) == 'A' || S.at(1) == 'A' || S.at(2) == 'A') {
    cout << "Yes" << endl;
  }

}


Measured memory_bytes: 256
import Control.Applicative

main :: IO ()
main = do
  [x, y] <- fmap read . words <$> getLine
  if (x, y) /= (0, 0)
  then do 
    loop x y
    putStrLn ""
    main
  else
    return ()
  where
    loop a b
      | a > 0 = do
        putStrLn ['#' | _ <- [1..b]]
        loop (a-1) b
      | otherwise = return ()
      
  


Measured memory_bytes: 4116
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)

// constexpr int MOD = 1e9+7;

int main(void){
    Cin(int, a, b);
    if((a+b) % 2 != 0){
      Cout("IMPOSSIBLE");
    }
  else{
    Cout((a+b)/2);
  }
}

Measured memory_bytes: 256
//In the name of ALLAH
#include <bits/stdc++.h>
#define pb push_back
#define X first
#define Y second
const bool DEBUG = false;
#define cerr if(DEBUG)cerr
using namespace std;

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

const long long maxn = 10000 + 5;
const long long INF = 4e18 ;
const long long M = 1e9 + 7;
const int lg = 21;

ll n, mx, mn, a[maxn], b[maxn];
multiset<ll> s;

int main(){
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n;
	for(int i = 0; i < n; i++)
		cin >> a[i];
	for(int i = 0; i < n; i++){
		cin >> b[i];
		int c = a[i] - b[i];
		if(c > 0)
			mx += c;
		if(c < 0)
			mn += ((-c) / 2);		
	}
	if(mx <= mn)
		return cout << "Yes" << endl, 0;		
	cout << "No" << endl;
	return 0;
}


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

using namespace std;

bool check(const string& S){
    string T = "keyence";
    if(S.size() < T.size()) return false;
    int a = 0, b = 0;
    for(int i=0;i<T.size();i++){ 
        if(S[i] != T[i]) break;
        a++;
    }
    for(int i=0;i<T.size();i++){
        if(S[S.size()-1-i] != T[T.size()-1-i]) break;
        b++;
    }
    return (a+b >= T.size());
}

int main(){
    string S;
    while(cin >> S){
        cout << (check(S) ? "YES" : "NO") << endl;
    }
}

Measured memory_bytes: 256
from statistics import mean, median,variance,stdev
import sys
import math
import fractions

def j(q):
    if q==1: print("AC")
    else:print("WA")
    exit(0)


def ct(x,y):
    if (x>y):print("")
    elif (x<y): print("")
    else: print("")

def ip():
    return int(input())

#n = ip()                              #入力整数1つ
x,y= (int(i) for i in input().split())      #入力整数横2つ
#x,y,z = (int(i) for i in input().split())    #入力整数横3つ
#n,m,x,y= (int(i) for i in input().split())  #入力整数横4つ
#a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列

#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意

d = y-x
a = [i for i in range(1,d)]
print(sum(a)-x)


Measured memory_bytes: 5340
use std::io;
fn main() {
    let mut ND = String::new();
    let mut X:Vec<i64>;
    io::stdin().read_line(&mut ND);
    let v:Vec<&str> = ND.split_whitespace().collect();
    let n:i32 = v[0].parse().ok().unwrap();
    let d:i32 = v[1].parse().ok().unwrap();
    let mut count:i32 = 0;
    // println!("n = {}, d = {}",n,d);
    for i in 0..n {
        let mut s = String::new();
        io::stdin().read_line(&mut s);
        let XY: Vec<&str> = s.split_whitespace().collect();
        let x:f64 = XY[0].parse().ok().unwrap();
        let y:f64 = XY[1].parse().ok().unwrap();
        // println!("x = {}, y = {}",x,y);
        if d as f64 >= (x*x + y*y).sqrt(){

            count+=1;
        }
    }
    println!("{}",count);
}


Measured memory_bytes: 2320
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();

		if (b - a <= 0) {
			System.out.println("delicious");
		}else if(b - a <= x) {
			System.out.println("safe");
		}else {
			System.out.println("dangerous");
		}
	}
}


Measured memory_bytes: 35532
#include <bits/stdc++.h>
#define ll long long

#define TASKNAME ""

using namespace std;

const int INF = 1e9 + 7;
const int MAXN = 1e6 + 7;
const double EPS = 1e-8;

ll sumd(ll n) {
    ll res = 0;
    while (n) {
        res += n % 10;
        n /= 10;
    }
    return res;
}

int main() {
    #ifdef MY
        freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
    #else
        //freopen(TASKNAME".in", "r", stdin);
        //freopen(TASKNAME".out", "w", stdout);
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
    #endif // MY
    ll n;
    cin >> n;
    ll x = 1;
    while (x <= n) {
        x *= 10;
    }
    x /= 10;
    ll k = x - 1;
    while (k + x <= n) {
        k += x;
    }
    cout << sumd(k);
}


Measured memory_bytes: 256
//31
#include<iostream>

using namespace std;

int main(){
  for(int n,m,p;cin>>n>>m>>p,n|m|p;){
    int s=0,b;
    for(int i=1;i<=n;i++){
      int x;
      cin>>x;
      s+=x;
      if(i==m){
	b=x;
      }
    }
    cout<<((b)?s*100*(100-p)/(100*b):0)<<endl;
  }
  return 0;
}

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

int main(){
  int R;
  cin >> R;
  if(R<1200){
    cout << "ABC" << endl;
  }
  else if(R<2800){
    cout << "ARC" << endl;
  }
  else{
    cout << "AGC" << endl;
  }
}

Measured memory_bytes: 3568
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String w = sc.next();
        ArrayList<Character> tmp = new ArrayList<>();
        loop: for (int i = 0; i < w.length(); i++) {
            int count = 1;
            char set = w.charAt(i);
            for (int k = 0; k < tmp.size(); k++) {
                if (tmp.get(k) == set) {
                    continue loop;
                }
            }
            for (int j = i + 1; j < w.length(); j++) {
                if (set == w.charAt(j)) {
                    count++;
                }
            }
            if (count % 2 != 0) {
                System.out.println("No");
                return;
            }
            tmp.add(set);
        }
        System.out.println("Yes");
    }
}

Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <cstring>
#include <sstream>
#include <iomanip>//小数精度 	cout << fixed << setprecision(5) << tmp << endl;
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define All(X)      (X).begin(),(X).end()
const ll int INF =1000000001;
int v,e,r;


struct edge {ll int from,to,cost; };

vector<edge> es(e);
vector<ll int> d(v);

bool find_negative_loop(){
	//memset(d,0,sizeof(d));
	fill(All(d),0);
	REP(i,v){
		REP(j,e){
			edge e = es[j];
			if(d[e.to] > d[e.from] + e.cost){
				d[e.to] = d[e.from] + e.cost;
				if(i==v-1) return true;
			}
		}
	}
	return false;
}

void SearchMinCost(int s){
	REP(i,v) d[i] = INF;
	d[s] = 0;
	while(true){
		bool update = false;
		REP(i,e){
			edge e = es[i];
			if(d[e.from]!=INF && d[e.to] > d[e.from] + e.cost ){
				d[e.to] = d[e.from] + e.cost;
				update = true;
			}
		}
		if(!update) break;
	}
}
int main(){
	cin >> v >> e >> r;
	es.resize(e);
	REP(i,e) {
		cin >> es[i].from >> es[i].to >> es[i].cost;
	}
	d.resize(v);
	SearchMinCost(r);

	//if(find_negative_loop()){
	//	cout <<"NEGATIVE CYCLE"<<endl;
	//}else{
		SearchMinCost(r);
		REP(i,v) {
			if(d[i]>=INF) cout << "INF" <<endl;
			else cout << d[i] <<endl;
		}
	//}
	return 0;
}

Measured memory_bytes: 13328
n = int(input())
*l, = map(int,input().split())
l[0] -= 1
ans = 'Yes'
for i in range(1,n):
  if l[i] > l[i-1]:
    l[i] -= 1
  elif l[i] < l[i-1]:
    ans = 'No'
    break
print(ans)

Measured memory_bytes: 14396
# F - Silver Fox vs Monster

import bisect

class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)

    # sum[0:i+1]
    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s

    # add x to i
    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i

N, D, A = map(int, input().split())
XH = sorted([list(map(int, input().split())) for _ in range(N)], key = lambda x: x[0])

X = [XH[i][0] for i in range(N)]
X_right = [bisect.bisect_right(X, XH[i][0] + 2*D) for i in range(N)]

ans = 0
bomb_damage = Bit(N+1)
for i in range(N):
    damage = bomb_damage.sum(i+1)
    if XH[i][1] - damage > 0:
        n_bomb = -(-(XH[i][1] - damage)//A)
        ans += n_bomb
        bomb_damage.add(i+1, n_bomb * A)
        bomb_damage.add(X_right[i]+1, -n_bomb * A)

print(ans)


Measured memory_bytes: 105900
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <deque>
#include <iomanip>
#include <cstdio>
#include <stack>
#include <numeric>

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

char p[]={'A','B','C'};

int main(){
    string s;
    cin >> s;
    ll res = 0;
    int id = 0;
    bool flag = 0;
    int n = s.size();
    ll c = 0;
    rep(i,n){
        if(s[i]==p[id]){
            if(!flag&&id==0){
                c=1;
                flag = 1;
            }
            if(id==2){
                res += c;
                id = 1;
                //cerr << i << " " << c << endl;
            }else{
                id++;
            }
        }else{
            if(id==1){
                if(s[i]==p[id-1]){
                    c++;
                }else{
                    id = 0;
                    flag = 0;
                    c = 0;
                }
            }else{
                if(s[i]!=p[0]){
                    id = 0;
                    flag = 0;
                    c = 0;
                }else{
                    id = 1;
                    flag = 1;
                    c = 1;
                }
            }
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 640
// Last Change: 03/23/2020 00:08:21.
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

const ll MAX = numeric_limits<ll>::max();

ll H, W, K;
vector<string> S;
vector<vector<ll>> imos;

ll getVal(ll x0, ll y0, ll x1, ll y1) {
  return imos[x1][y1] - imos[x1][y0] - imos[x0][y1] + imos[x0][y0];
}

ll calc(vector<int> cut, int depth) {
  if (depth < H) {
    ll res = calc(cut, depth + 1);
    cut.push_back(depth);
    res = min(res, calc(cut, depth + 1));
    return res;
  }

  ll cnt = cut.size();

  cut.push_back(H);

  ll lastCutY = 0;
  for (ll i = 1; i < W + 1; ++i) {
    ll lastCutX = 0;
    for (int j = 0; j < cut.size(); ++j) {
      ll x0, y0, x1, y1;
      x0 = lastCutX, y0 = lastCutY;
      x1 = cut[j], y1 = i;

      lastCutX = x1;

      ll val = getVal(x0, y0, x1, y1);
      if (val > K) {
        if (lastCutY == i - 1) {
          return MAX;
        }
        lastCutY = i - 1;
        ++cnt;
        --i;
        break;
      }
    }
  }
  return cnt;
}

int main() {
  cin >> H >> W >> K;
  S.resize(H);
  for (auto &&e : S) {
    cin >> e;
  }

  imos.resize(H + 1);
  fill(imos.begin(), imos.end(), vector<ll>(W + 1, 0));
  for (ll i = 0; i < H; ++i) {
    for (ll j = 0; j < W; ++j) {
      imos[i + 1][j + 1] =
          imos[i][j + 1] + imos[i + 1][j] - imos[i][j] + (S[i][j] == '1');
    }
  }

  cout << calc(vector<int>(), 1) << endl;
}


Measured memory_bytes: 384
N = int(input())

max_cnt = 0
cnt = 0
for i in range(N):
    a, b = map(int, input().split())
    if a == b:
        cnt += 1
    else:
        cnt = 0
    max_cnt = max(max_cnt, cnt)

if max_cnt >= 3:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 9040
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String[] args){
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		List<Integer> aList = new ArrayList<>();
		for(int i=0;i<3;i++){
			aList.add(sc.nextInt());
		}
		Collections.sort(aList);
		out.println(aList.get(2)-aList.get(0));
		out.flush();
	}
}



class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}

Measured memory_bytes: 21204
#include <stdio.h>
#include <math.h>
#define rad M_PI/3
#define N 500001

typedef struct{
    double x,y;
}Point;
void print(Point p){
    printf("%.10f %.10f\n",p.x,p.y);
}
Point rotate(Point p1,Point p2){
    double x=p2.x-p1.x;
    double y=p2.y-p1.y;
    Point p={x*cos(rad)-y*sin(rad)+p1.x,x*sin(rad)+y*cos(rad)+p1.y};
    return p;
}
void koch(int n,Point p1,Point p2){
    if(n==0) return;
    Point s={p1.x+(p2.x-p1.x)/3.0,p1.y+(p2.y-p1.y)/3.0};
    Point t={p1.x+(p2.x-p1.x)*2.0/3.0,p1.y+(p2.y-p1.y)*2.0/3.0};
    Point u = rotate(s,t);
    koch(n-1,p1,s);
    print(s);
    koch(n-1,s,u);
    print(u);
    koch(n-1,u,t);
    print(t);
    koch(n-1,t,p2);
}
int main()
{
  int n;
  Point p1={0,0};
  Point p2={100,0};
  scanf("%d",&n);
  print(p1);
  if(n>0){
      koch(n,p1,p2);
  }
  print(p2);
  return 0;
}


Measured memory_bytes: 2104
using System;

namespace AtCoder
{
    static class Program
    {
        static void Main()
        {
            int N = int.Parse(Console.ReadLine());
            int res = 1;

            for(int i = 0; i < N; i++)
            {
                if (res * 2 <= N)
                    res *= 2;
                else
                    break;
            }

            Console.WriteLine(res);
        }
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N;
    cin >> N;
    
    string S;
    
    bool a = false;
    
    for(int i = 0; i < N; i++){
        
        cin >> S;
        
        if(S == "Y"){
            a = true;
        }
    }
    if(a){
        cout << "Four" << endl;
    }else{
        cout <<  "Three" << endl;
    }
}  

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

typedef long long ll;

using namespace std;

#define swap(a, b)    do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while(0)
#define repd(i, a, b) for(typeof(b) i = a; i < (b); ++i)
#define rep(i, n)     repd(i, 0, n)
#define dump(x)       cerr << #x << " = " << (x) << endl
#define debug(x)      cerr << "L" << __LINE__ << ": " << #x << " = " << (x) << endl
#define YesNo(x) cout << ((x) ? "Yes" : "No") << endl
#define YESNO(x) cout << ((x) ? "YES" : "NO") << endl

int main(int argc, const char* argv[]) {
	ll n;
	cin >> n;
	if(n == 1) {
		cout << "Hello World" << endl;
	} else {
		ll x, y;
		cin >> x >> y;
		cout << x + y << endl;
	}

	return 0;
}


Measured memory_bytes: 256
def resolve():
    N, X = map(int, input().split())
    A = list(map(int, input().split()))

    ans = 0
    for i in range(1, N):
        diff = max((A[i - 1] + A[i]) - X, 0)
        ans += diff
        A[i] = max(A[i] - diff, 0)

    print(ans)


if __name__ == "__main__":
    resolve()

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

int main() {
  int c0 = 0,c1 = 0;
  string s;
  cin >> s;
  for(int i = 0;i < s.size();i++){
    if(s.at(i) == '0') c0++;
    else c1++;
  }
  cout << min(c0,c1)*2 << endl;
}


Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define rep(i,n) for(ll i=0;i<n;i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define INF 1e9+7
#define LLINF 1e18
using namespace std;
const int MOD = 1e9 +7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,ans=0;
    cin>>n;
    for(ll i=1;i*(i+2)<=n;i++){
       if(n%i==0){
           ans+=n/i-1;
       } 
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const ll INF = 1LL << 60; //MAX 9223372036854775807

ll ans = INF;

int main()
{
ll n ;
cin >> n ;
ll sum=0;
vector<ll> a(n);
rep(i, n){
  cin >> a[i];
  sum+=a[i];
}
ll t=0;
rep(i,n-1){
  t+=a[i];
  ans=min(ans,abs(sum-t-t));
}

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

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

int main (){
    int a,b,c,k;

    cin >> a >> b >> c;

    if(a>b){
        k = a;
        a = b;
        b = k;
    }
    if(b>c){
        k = b;
        b = c;
        c = k;
    }
    if(a>b){
        k = a;
        a = b;
        b = k;
    }
        

    cout << a <<" "<< b <<" "<< c << endl;
   
    return 0;
}


Measured memory_bytes: 3044
#include<bits/stdc++.h>
using namespace std;
char R[505][505],B[505][505],s[505];
int n,m;
int main(){
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;i++){
		for (int j=2;j<m;j++){
			R[i][j]=(i&1)?'.':'#';
			B[i][j]=(i&1)?'#':'.';
		}
		R[i][1]=B[i][m]='.';
		R[i][m]=B[i][1]='#';
	}
	for (int i=1;i<=n;i++){
		scanf("%s",s+1);
		for (int j=1;j<=m;j++)
			if (s[j]=='#')
				if (i&1) R[i][j]='#';
				else B[i][j]='#';
	}
	for (int i=1;i<=n;i++)
		printf("%s\n",R[i]+1);
	puts("");
	for (int i=1;i<=n;i++)
		printf("%s\n",B[i]+1);
}

Measured memory_bytes: 1280
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main()
    {
        var N = int.Parse(ReadLine());
        var A = ReadLine().Split().Select(int.Parse).ToArray();
        var B = new int[N];
        for (int i = 0; i < N; i++)
        {
            B[i] = A[i] - i - 1;
        }

        Array.Sort(B);
        var list = new List<int>();
        var a = B[N/2];
        list.Add(a);
        list.Add(a-1);
        list.Add(a-2);
        if(N!=1)
        {
            a = B[N / 2 - 1];
            list.Add(a);
        list.Add(a-1);
        list.Add(a-2);
        }
        var ans = long.MaxValue;
        for (int i = a - 2; i < 5; i++)
        {
            
        }
        foreach (var i in list)
        {
            var m = 0L;
            for (int j = 0; j < N; j++)
            {
                m += Math.Abs(B[j] - i);
            }
            ans = Math.Min(ans, m);
        }
        WriteLine(ans);
    }
}

Measured memory_bytes: 31876
#include <bits/stdc++.h>
#define rep0(i,n) for (int i = 0; i < (n); ++i)  //0index
#define rep1(i,n) for (int i = 1; i < (n); ++i)  //1index
#define REP(i,a,b) for (int i = a; i < (b); ++i)  //aからb - 1まで
#define mREP(i,a,b) for (int i = a; i > (b); --i)  //逆
#define all(x) (x).begin(),(x).end()
const int INF = 1000000007;  //最大値兼MOD
typedef long long ll;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }  //GCD

int dp[1000000];
int main(){
    int N;
    cin >> N;
    vector<int>H(N);
    rep0(i,N)cin >> H[i];
    dp[0] = 0;
    rep1(i,N){
        if(i == 1)dp[i] = dp[0] + abs(H[0] - H[1]);
        else{
            dp[i] = min(dp[i - 1] + abs(H[i - 1] - H[i]),dp[i - 2] + abs(H[i - 2] - H[i]));
        }
    }
    cout << dp[N-1] << endl;
    return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;
    
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int sum = 0,a;
        while(true){
            int t = sc.nextInt();
            if(t == 0){
                break;
            }else{
                int n = sc.nextInt();
            	for(int i = 1; i<=n; i++){
                    int s = sc.nextInt();
                    int f = sc.nextInt();
                    
                    sum += f - s;
                }
                if(sum >= t){
                	System.out.println("OK");
            	}else{
                	a = t -sum;
                	System.out.println(a);
            	}
                sum = 0;
            }
            
        }
        sc.close();
    }
}


Measured memory_bytes: 31232
#define TEMPLATE_USED
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) for(ll i=0;i<(n);++i)
#define _rep3(i,a,b) for(ll i=(ll)(a);i<(ll)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2)(__VA_ARGS__)
#define _repe2(i,n) for(ll i=0;i<=(ll)(n);++i)
#define _repe3(i,a,b) for(ll i=(ll)(a);i<=(ll)(b);++i)
#define repe(...) _overload3(__VA_ARGS__,_repe3,_repe2)(__VA_ARGS__)
#define _rrep2(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define _rrep3(i,a,b) for(ll i=(ll)(b)-1;i>=(ll)(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2)(__VA_ARGS__)
#define _rrepe2(i,n) for(ll i=(ll)(n);i>=0;i--)
#define _rrepe3(i,a,b) for(ll i=(ll)(b);i>=(ll)(a);i--)
#define rrepe(...) _overload3(__VA_ARGS__,_rrepe3,_rrepe2)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
template<class T>
bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>
bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}

ll N;
vl A;

void solve();

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cin >> N;
    A = vl(N);
    for(int i = 0; i < N; ++i){
        cin >> A[i];
    }
    solve();
}

// 2 <= N <= 10^6
// 1 <= A_i<= 10^6

// ll N, vl A
// \{A_i\} が pairwise coprime ならば pairwise coprime、setwise coprime ならば setwise coprime、そのどちらでもなければ not coprime と出力せよ。
void solve(){
    ll g=A[0];
    rep(i,N)g=__gcd(g,A[i]);
    if(g!=1){
        cout<<"not coprime"<<endl;
        return;
    }
    set<ll> st;
    rep(i,N){
        for(ll j=2;j*j<=A[i];j++){
            if(A[i]%j==0){
                if(st.count(j)){
                    cout<<"setwise coprime"<<endl;
                    return;
                }
                st.insert(j);
                while(A[i]%j==0)A[i]/=j;
            }
        }
        if(A[i]!=1){
            if(st.count(A[i])){
                cout<<"setwise coprime"<<endl;
                return;
            }
            st.insert(A[i]);
        }
    }
    cout<<"pairwise coprime"<<endl;
}


Measured memory_bytes: 11064
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(3*max(max(a,b),c)+3*min(min(a,b),c)==2*a+2*b+2*c){
    /*
    推导过程：
    最大数=max(max(a,b),c) 最小数=min(min(a,b),c) （如果这都不知道你就可以走了）
    所以:第二大数=a+b+c-max(max(a,b),c)
    最大数-第二大数=第二大数-最小数 可化为：
    max(max(a,b),c)-(a+b+c-max(max(a,b),c)-min(min(a,b),c))=(a+b+c-max(max(a,b),c)-min(min(a,b),c))-min(min(a,b),c)
    整理可得：
    3*max(max(max(a,b),c)+3*min(min(a,b),c)==2*a+2*b+2*c
    */
    cout<<"YES";//谁抄谁稻花香里说丰年
    return 0;
    }
    cout<<"NO";//谁抄谁稻花香里说丰年
    return 0;
}

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

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

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

// Self settings
// clang-format off
#define MAX_N 100
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1 << 31;
// clang-format on

int N, D, X;
int A[MAX_N];

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

  cin >> N >> D >> X;
  REP(i, N) cin >> A[i];

  int ans = 0;
  for (int i = 0; i < N; i++) {
    ans += ((D - 1) / A[i]) + 1;
  }
  ans += X;

  cout << ans << endl;

  return 0;
}


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

int S[21];
int n,q;
bool dfs(int i,int m)
{
    if(m == 0) return true;
    if(i >= n) return false;
    return dfs(i+1,m) || dfs(i+1,m-S[i]);
}
int main()
{
    cin >> n;
    for(int i=0;i<n;i++)
        cin >> S[i];
    cin >> q;
    for(int i=0;i<q;i++){
        int v;
        cin >> v;
        if(dfs(0,v))
            cout << "yes" << endl;
        else
            cout << "no" << endl;
    }
}


Measured memory_bytes: 3108
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include<vector>
#include<iomanip>
#include<map>
#include <queue>
#include<cmath>
#include<cstdio>
#include<iomanip>
#include<set>
#include <bits/stdc++.h>

using namespace std;
using ll = long long int;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++) //REP(i, 5) cout<<i;
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define MOD 10000007 //10^9+7

ll gcd(ll a, ll b) {
  ll tmp;
  if ( b > a) {
    tmp = a;
    a = b;
    b = tmp;
  }
  while (a % b !=0) {
    tmp = b;
    b = a % b;
    a = tmp;
  }
  return b;
}


int main(void){
  
  ll n;
  cin>>n;

  vector<ll> v(n+1);
  REP(i, n+1) v[i] = 0;

  REP(i, n-1){
    ll x;
    cin>>x;
    v[x]++;
  }

  FOR(i, 1, n){
    cout<<v[i]<<endl;
  }
  return 0;

}

Measured memory_bytes: 4844
#include <stdlib.h>
#include <iostream>
#include <algorithm>

using namespace std;

int main(void){
    int A, B, C, ans;

    cin >> A >> B >> C;
    if(A == B){
        ans = C;
    }
    else if(B == C){
        ans = A;
    }
    else{
        ans = B;
    }

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

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
public class Main extends PrintWriter {
    Main()
    {
        super(System.out);
    }
    public static void main(String args[]) throws Exception {
      Main o=new Main();
      o.main();
      o.flush();
      o.close();
    }
    void main() throws Exception
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        int n=Integer.parseInt(br.readLine());
            
            char ch[]=br.readLine().toCharArray();
            ArrayList<Integer> rs=new ArrayList<>(),
            ws=new ArrayList<>();
            int c=0;
            int i;
            for(i=0;i<n;i++)
            {
                if(ch[i]=='W')
                ws.add(i);
                else
                rs.add(i);
            }
            int f=0,l=rs.size()-1;
            while(f<ws.size() && l>=0 && rs.get(l)>ws.get(f))
            {
                
                f++;
                l--;
                c++;
            }
            println(c);
            br.close();
    }
}

Measured memory_bytes: 42536
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.Stack;

class Main {

    public static void main(String[] args) {
        new Main().compute();
    }

    void compute() {
        Scanner sc = new Scanner(System.in);
        sc.useDelimiter("[\\s]+");
        int[] a = new int[5];
        for (int i = 0; i < 5; i++) {
            a[i] = sc.nextInt();
        }
        Arrays.sort(a);
        for (int i = 4; i > 0; i--) {
            System.out.print(a[i] + " ");
        }
        System.out.println(a[0]);
    }
}


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

const int mx = 200001;

int u[mx];

int find(int child) {
  int parent = u[child];
  if(child==parent) {
    return parent;
  }
  return u[child] = find(parent);
}

void unite(int c, int d) {
  int root_c = find(c);
  int root_d = find(d);
  if(root_d == root_c) {
    return;
  }

  u[root_c] = root_d;
  return;
}

bool is_same_unit(int a, int b) {
  return find(a) == find(b);
}

ll d(int n, int m, vector<int> a, vector<int> b) {

  for(int i=0;i<n;i++) {
    u[i] = i;
  }
  for(int i=0;i<m;i++) {
    int aa = a[i] - 1;
    int bb = b[i] - 1;
    if(!is_same_unit(aa, bb)) {
      unite(aa, bb);
    }
  }
  /*
  for(int i=0;i<n;i++) {
    cout << i + 1 << " -> " << find(i) +  1<< endl;
  }
  */
  map<int, int> cnt;
  for(int i=0;i<n;i++) {
    cnt[find(i)] += 1;
  }
  ll ans = -1;
  for(auto item: cnt) {
    ans = max(ans, (ll) item.second);
  }
  return ans;
}

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(m);
  vector<int> b(m);

  for(int i=0;i<m;i++) {
    cin >> a[i] >> b[i];
  }
  cout << d(n, m, a, b);
}

Measured memory_bytes: 13636
import itertools

N, M, Q = [int(i) for i in input().split()]
ABCD = [list(map(int, input().split())) for i in range(Q)]
score = 0
for A in itertools.combinations_with_replacement(range(1, M+1), N):
    tmp = 0
    for a, b, c, d in ABCD:
        if A[b-1] - A[a-1] == c:
            tmp += d
    score = max(score, tmp)
print(score)


Measured memory_bytes: 9192