akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;

vector<int> primes;
map<int, int> factors;
 
void erathosthenes(ll n) {
    vector<bool> primeFlags(n+10, true);
    primeFlags[0] = primeFlags[1] = false;
    vector<int> sqrtprimes;
    for (int i = 2; i*i <= n; i++) {
        bool mod0 = false;
        for (int j = 2; j*j <= i; j++) {
            if (i%j == 0) mod0 = true;
        }
        if (!mod0) sqrtprimes.push_back(i);
    }
    for (auto &&e: sqrtprimes) {
        for (int i = 2; i <= n; i++) {
            if (i%e == 0) primeFlags[i] = false;
        }
    }
    for (auto &&e: sqrtprimes) primeFlags[e] = true;
    for (int i = 1; i <= n; i++) if (primeFlags[i]) primes.push_back(i);
    return;
}
 
void factoring(ll n) {
    ll m = sqrt(n);
    erathosthenes(m);
    for (auto &&e: primes) {
        while(n%e == 0){
            factors[e]++;
            n /= e;
        }
    }
    factors[n]++;
    factors.erase(1);
}

class combM {
private:
    vector<ll> fac;  //n!(mod M)
    vector<ll> ifac; //k!^{M-2} (mod M)
public:
    ll mpow(ll x, ll n);
    combM();
    ll com(ll a, ll b);
};

// x^n(mod M)
ll combM::mpow(ll x, ll n) {
    ll ans = 1ll;
    while(n != 0){
        if (n&1) ans = ans*x%MOD;
        x = x*x%MOD;
        n = n >> 1;
    }
    return ans;
}

// aCb をmod計算
ll combM::com(ll a, ll b) {
    if (a == 0 && b == 0) return 1;
    if (a < b || a < 0) return 0;
    ll tmp = ifac[a-b]*ifac[b]%MOD;
    return tmp*fac[a]%MOD;
}

combM::combM() {
    fac.resize(300001);
    ifac.resize(300001);
    fac[0] = 1;
    ifac[0] = 1;
    for (ll i = 0; i < 300000; ++i) {
        fac[i+1] = fac[i]*(i+1)%MOD;
        ifac[i+1] = ifac[i]*mpow(i+1, MOD-2)%MOD;
    }
}

int main(int argc, char const *argv[]) {
    ll n, m;
    cin >> n >> m;
    factoring(m);
    ll ans = 1ll;
    combM C;
    for (auto &&e: factors) {
        ans = (ans*(C.com(e.second+n-1, e.second)))%MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4992
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
string devide[4]={"dream","dreamer","erase","eraser"};
int main(){
  string s;
  cin>>s;
  reverse(s.begin(),s.end());
  for(int i=0;i<4;i++)reverse(devide[i].begin(),devide[i].end());
  bool can=true;
  for(int i=0;i<s.size();){
    bool can2=false;
    for(int j=0;j<4;j++){
      string d=devide[j];
      if(s.substr(i,d.size())==d){
        can2=true;
        i+=d.size();
      }
    }
    if(!can2){
      can=false;
      break;
    }
  }
  if(can)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  
}

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

 static int Num=100;

int main(){
  int i,h,j,k,n,p[Num+1],m[Num+1][Num+1];
  
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&p[i-1]);
    scanf("%d",&p[i]);
  }

  for(i=1;i<=n;i++)m[i][i]=0;

  for(h=2;h<=n;h++){
    for(i=1;i<=n-h+1;i++){
      j=i+h-1;
      m[i][j]=1<<21;
      for(k=i;k<=j-1;k++){
	m[i][j]=fmin(m[i][j],m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j]);
      }
    }
  }

  printf("%d",m[1][n]);
  printf("\n");
  return 0;
}


Measured memory_bytes: 2112
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define pb push_back
#define mp make_pair
#define y1 y114514
#define elif else if
#define VPII vector<PII>
#define y2 y1919810
typedef pair<int, int> PII;
typedef vector<int> VI;
//#define int long long
#define all(x) x.begin(), x.end()
#define lsh(i) (1 << (i))
#define lshll(i) (1LL << (i))
#define repn(i, n) for (int i = 1; i <= (int)n; i++)
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define range(i, s, t) for (int i = s; i <= (int)t; i++)
#define RESET(x) memset((x), 0, sizeof(x))
const int INF = 0x3f3f3f3f;
const long double EPS = 1e-6;
const int N = 200020;
int fa[N], sz[N], n, m;
void init(int size) {
  rep(i, size) {
    fa[i] = i;
    sz[i] = 1;
  }
}
int find(int x) { return x == fa[x] ? x : fa[x] = find(fa[x]); }
void merge(int x, int y) {
  x = find(x);
  y = find(y);
  if (x == y) return;
  if (sz[x] < sz[y]) swap(x, y);
  fa[y] = x;
  sz[x] += sz[y];
}
void solve() {
  cin >> n;
  init(n + 1);
  cin >> m;
  repn(i, m) {
    int u, v;
    cin >> u >> v;
    merge(u, v);
  }
  int ans = 0;
  repn(i, n) if (fa[i] == i) ans = max(ans, sz[i]);
  cout << ans << endl;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int T = 1;
  // cin >> T;
  while (T--) solve();
  return 0;
}


Measured memory_bytes: 5212
#include<bits/stdc++.h>
#define LL long long
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
using namespace std;
inline int read(){
	int v=0,f=1;
	char c=getchar();
	while (c<'0' || c>'9'){
		if (c=='-') f=-1;
		c=getchar();
	}
	while (c>='0' && c<='9'){
		v=v*10+c-'0';
		c=getchar();
	}
	return v*f;
}
const int Maxn=3005;
int n;
LL mod;
LL fact[Maxn],ivf[Maxn];
LL qp(LL x,LL p){
	LL ret=1;
	while (p){
		if (p&1) ret=ret*x%mod;
		p>>=1;
		x=x*x%mod;
	}
	return ret;
}
LL Qp(LL x,LL p){
	LL ret=1;
	while (p){
		if (p&1) ret=ret*x%(mod-1);
		p>>=1;
		x=x*x%(mod-1);
	}
	return ret;
} 
LL inv(LL x){
	return qp(x,mod-2);
}
LL C(LL x,LL y){
	return fact[x]*ivf[y]%mod*ivf[x-y]%mod;
}
LL H[Maxn][Maxn];
void _init(){
	fact[0]=1;//cerr<<123<<endl;
	for (int i=1;i<Maxn;i++) fact[i]=fact[i-1]*i%mod;
	for (int i=0;i<Maxn;i++) ivf[i]=inv(fact[i]);
	H[0][0]=1;//cerr<<123<<endl;
	for (int i=1;i<Maxn;i++){
		H[i][0]=1;
		for (int j=1;j<=i;j++){
			H[i][j]=(H[i-1][j-1]+H[i-1][j]*(j+1))%mod;
		}
	}
}
int main(){
	scanf("%d %lld",&n,&mod);
	_init();
	
	LL ans=0;
	for (int i=0;i<=n;i++){
		LL coef=C(n,i);
		LL t=Qp(2,n-i);
		t=qp(2,t);
		coef=coef*t%mod;
		if (i&1) coef=mod-coef;
		LL cur=0;
		for (int k=0;k<=i;k++){
			cur+=qp(2,(n-i)*k)*H[i][k];
			cur%=mod;
		}
		ans+=coef*cur;
		ans%=mod;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 69248
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
constexpr ll INF = 1ll<<30;
constexpr ll MOD = 1000000007;
//---------------------------------//

ll dp[32][800];
ll dp2[32][800];

int main() {
	int N, M, K;
	cin >> N >> M >> K;
	vector<int> P(M);
	REP(i, M) {
		scanf("%d", &P[i]);
		P[i] %= N;
	}
	
	++dp[0][0];
	REP(i, M) ++dp[0][P[i] % N];
	
	REP(t, 31) REP(i, N) REP(j, N) {
		(dp[t + 1][(i + j) % N] += dp[t][i] * dp[t][j] % MOD) %= MOD;
	}
	
	dp2[31][0] = 1;
	for (int t = 30; t >= 0; --t) {
		if (K >> t & 1) {
			REP(i, N) {
				REP(j, N) {
					(dp2[t][(i + j) % N] += dp2[t + 1][i] * dp[t][j] % MOD) %= MOD;
				}
			}
		}
		else {
			REP(i, N) dp2[t][i] = dp2[t + 1][i];
		}
	}
	REP(i, N) printf("%lld\n", dp2[0][i]);
	return 0;
}





Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr << #x << ": " << x << endl
int main() {
  string s;
  cin >> s;
  vector<string> tpl = {"abc", "acb", "bac",
                        "bca", "cab", "cba"};
  rep(i, tpl.size()) if(s == tpl[i]) {
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    double v;
    double y,t;
    int N;

    while (scanf("%lf", &v) != EOF){
        t = v / 9.8;
        y = 4.9 * t * t;
        N = ((int)y + 5) / 5;
        printf("%d\n", N+1);
    }

    return (0);
}


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

#define INF 1e18
#define MAX_V 100000
typedef pair<ll, int> P;  // (first,second) := (最短距離,頂点番号)

struct edge {
    int to;
    ll cost;
};
vector<edge> G[MAX_V];

ll d[MAX_V];
int V, E;

// 頂点rからの最小距離
void dijkstra(int r) {
    priority_queue<P, vector<P>, greater<P>> que;
    fill(d, d + V, INF);
    que.push(P(0, r));
    d[r] = 0;

    while (que.size()) {
        P p = que.top();
        que.pop();
        int v = p.second;
        if (d[v] < p.first) continue;
        for (int i = 0; i < G[v].size(); i++) {
            edge e = G[v][i];
            if (d[v] + e.cost < d[e.to]) {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}

int main() {
    cin >> V >> E;
    for (int i = 0; i < E; i++) {
        int L, R;
        ll C;
        cin >> L >> R >> C;
        L--, R--;
        G[L].push_back({R, C});
    }
    for (int i = 1; i < V; i++) {
        G[i].push_back({i - 1, 0});
    }
    dijkstra(0);
    if (d[V - 1] == INF)
        cout << -1 << endl;
    else
        cout << d[V - 1] << endl;
    return 0;
}

Measured memory_bytes: 9340
#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<sstream>
#include<list>
#include<queue>
#include<algorithm>
#include<functional>
#include<map>
#include<set>
#include<utility>
#include<initializer_list>
#include<tuple>
#include<regex>
using namespace std;
#define ull unsigned long long
#define ll long long
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define all(t) t.begin(), t.end()
#define mat(type, row, col, init) vector<vector<type>>(row, vector<type>(col, init));

int main() {
	int n;
	cin >> n;
	vector<ll>a(n), b(n), d(n,0);
	rep(i, n) {
		cin >> a[i];
	}
	rep(i, n) {
		cin >> b[i];
		d[i] = b[i] - a[i];
	}
	ll sum = 0;
	ll misum = 0;
	rep(i, n) {
		if (d[i] > 0) {
			sum += d[i] / 2;
		}
		else if (d[i] < 0) {
			misum += d[i];
		}
	}
	if (abs(misum )<= sum) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
		

	return 0;
}





Measured memory_bytes: 512
#include <iostream>
#include <stack>

int main(){
	std::stack<int> garage;
	int vehicle_num;
	while(std::cin >> vehicle_num){
		if(vehicle_num != 0) garage.push(vehicle_num);
		else{
			std::cout << garage.top() << std::endl;
			garage.pop();
		}
	}
	
	return 0;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
#define PI acos(-1)

using namespace std;

int main()
{
    int n;
    string str;

    cin >> n >> str;

    if(str.size() > n) {
        cout << str.substr(0, n) + "..." << endl;
    } else {
        cout << str << endl;
    }

    return 0;
}


Measured memory_bytes: 3600
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <map>
#include <cmath>
#include <cstring>

#define fi first
#define se second
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = 1; i < (n); ++i)
#define drep(i,n) for (int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define all(x) (x).begin(), (x).end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define pb push_back
#define sz(x) (int)(x).size()
#define PQ(T) priority_queue<T, v(T), greater<T> >

using namespace std;
typedef long long ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;

const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

const int mod = 1000000007;

int main() {
    ll N, K, R, S, P;
    cin >> N >> K >> R >> S >> P;
    string T;
    cin >> T;

    ll ans = 0;
    rep(i,K) {
        ll last = i;
        for (ll now = i; now<N; now+=K) {
            if (last==now-K && T[now-K]==T[now]) continue;
            else {
                last = now;
                switch(T[now]) {
                    case 'r': ans += P; break;
                    case 's': ans += R; break;
                    case 'p': ans += S; break;
                }
            } 
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 512
import java.util.*;
import java.io.*;

public class Main{
  public static void main(String[] args) throws Exception{
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String s = br.readLine();
    
    if(s.equals("A")) System.out.println("T");
    else if(s.equals("T")) System.out.println("A");
    else if(s.equals("G")) System.out.println("C");
    else System.out.println("G");
  }
}

Measured memory_bytes: 20948
#include<stdio.h>
int main(void) {
	int n;
	int N[100010];
	double Na[100010];
	scanf("%d", &n);
	double ans=0.0;
	for (int i = 0; i < n; i++) {
		scanf("%d", &N[i]);
		Na[i] = (double)1 / N[i];
		ans += Na[i];
	}
	printf("%lf", 1 / ans);

	/*ちんこちんこちんこ！！！！！！！！！！*/
	return 0;
}


Measured memory_bytes: 128
mod = 10 ** 9 + 7

n,m = map(int,input().split())

x = list(map(int,input().split()))
y = list(map(int,input().split()))

sum_h = 0
sum_v = 0
for i in range(n-1):
  sum_h += (x[i+1] - x[i])*(i+1)*(n-i-1)
sum_h = sum_h % mod

for j in range(m-1):
  sum_v += (y[j+1] - y[j])*(j+1)*(m-j-1)
sum_v = sum_v % mod

sum = (sum_h * sum_v) % mod

#print(sum_h,sum_v)
print(sum)


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

int main() { 
    int n, sum = 0, sum_ = 0;
    cin >> n;
    int a[n], b[n] = {0};
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        sum += a[i];
        if(i%2) sum_ += a[i];
    }
    b[0] = sum - 2*sum_;
    for(int i = 1; i < n; i++) {
        b[i] = (a[i-1] - b[i-1]/2)*2;
    }

    for(int i = 0; i < n; i++) {
        cout << b[i] << " ";
    }
    cout << '\n';

    return 0;
}


Measured memory_bytes: 2048
n, m, _ = map(int, input().split())
exem = list(range(n))
i = 0

for a in map(int, input().split()):
    is_odd = a & 1
    i += -a if a & 1 else a
    i %= n
    exem.pop(i)
    n -= 1

exem = set(exem)
for q in map(int, input().split()):
    print(int(q in exem))

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

using namespace std;

int N, M;
long long dp[100005];
long long MOD = 1e9+7;
bool bad[100005];

int main(){
    cin >> N >> M;
    while(M--){
        int n;
        cin >> n;
        bad[n] = 1;
    }
    dp[0] = 1;
    if(!bad[1]){
        dp[1] = 1;
    }
    for(int i = 2; i<=N; i++){
        if(!bad[i]){
            dp[i] = dp[i-1] + dp[i-2];
            dp[i] %= MOD;
        }
    }
    cout << dp[N] << endl;
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
#define INF (1<<20)
int N;
int c[1010],w[1010];
bool memo[1010][1010];
int dp[1010];

void solve(int l,int r,int now,int weight){
  if(0 > l || N <= r) return;
  if(memo[l][r]) return;
  
  if(c[now] < weight) return;
  
  memo[l][r] = true;
  
  solve(l,r+1,r+1,weight+w[now]);
  solve(l-1,r,l-1,weight+w[now]);
}

int main(){
  cin >> N;
  for(int i=0;i<N;i++){
    cin >> c[i] >> w[i];
  }
  memset(memo,false,sizeof(memo));
  for(int i=0;i<N;i++){
    solve(i,i,i,0);
  }
  
  fill_n(dp,1010,INF);
  dp[0] = 0;
  
  for(int i=0;i<N;i++){
    for(int j=i;j<N;j++){
      if(memo[i][j]){
	dp[j+1] = min(dp[j+1],dp[i]+1);
      }
    }
  }
  cout << dp[N] << endl;
}

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

int main()
{
    int H, W;
    cin >> H >> W;

    char c;
    int a[H+1][W+1];
    for(int i = 1; i <= H; i++) for(int j = 1; j <= W; j++)
    {
        cin >> c;
        a[i][j] = (c == '.');
    }
    for(int i = 2; i <= H; i++) a[i][1] *= a[i-1][1];
    for(int j = 2; j <= W; j++) a[1][j] *= a[1][j-1];
    for(int i = 2; i <= H; i++) for(int j = 2; j <= W; j++)
    {
        a[i][j] = (a[i][j] * (a[i-1][j] + a[i][j-1])) % 1000000007;
    }
    cout << a[H][W] << '\n';
    return 0;
}

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

using namespace std;

#define EPS 1e-10

struct Point {
    double x, y;

    Point(){}
    Point(double x, double y) : x(x), y(y) {}
    Point operator - (const Point &p) const {  return Point(x - p.x, y - p.y); }
};

double dot(const Point &a, const Point &b)
{
    return a.x * b.x + a.y * b.y;
}

double cross(const Point &a, const Point &b)
{
    return a.x * b.y - b.x * a.y;
}

double norm(const Point &p){
    return dot(p, p);
}

#define COUNTER_CLOCKWISE +1
#define CLOCKWISE         -1
#define ONLINE_BACK       +2
#define ONLINE_FRONT      -2
#define ON_SEGMENT        +0
typedef Point Vector;

int ccw(const Point &p0, const Point &p1, const Point &p2)
{
    Vector a = p1 - p0;
    Vector b = p2 - p0;
    if (cross(a, b) > EPS)  return COUNTER_CLOCKWISE;
    if (cross(a, b) < -EPS) return CLOCKWISE;
    if (dot(a, b) < -EPS)   return ONLINE_BACK;
    if (norm(a) < norm(b))  return ONLINE_FRONT;
    return ON_SEGMENT; 
}

istream &operator >> (istream &is, Point &p)
{
    return is >> p.x >> p.y;
}

bool in_triangle(Point *p, Point &xp)
{
    int res = 0;
    for (int i = 0; i < 3; i++) {
        res += ccw(xp, p[i], p[(i+1)%3]);
    }
    return (res == -3 || res == 3);
}

int main()
{
    Point p[3], xp;
    while (cin >> p[0] >> p[1] >> p[2] >> xp) {
        cout << (in_triangle(p, xp) ? "YES" : "NO") << endl;
    }
    return 0;
}

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

using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, m, x, temp;
    cin >> n >> m >> x;
    int l = 0, r = 0;
    for(int i = 0; i < m; i++) {
        cin >> temp;
        if(temp < x) l++;
        else r++;
    }
    cout << min(l, r) << endl;
    return 0;
}


Measured memory_bytes: 3604
#include <stdio.h>
#include<string.h>
long long int yagamiraito(long long x,long long y)
{
    if(y==0) return x;
    return yagamiraito(y,x%y);
}
long long int yagamiraito1(long long x,long long y)
{
    return x/yagamiraito(x,y)*y;
}
int main(void)
{
    long long a[105];
    int n,i;
    a[0]=1;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        scanf("%lld",&a[i]);
        a[i]=yagamiraito1(a[i-1],a[i]);
    }
    printf("%lld\n",a[i-1]);
    return 0;
}


Measured memory_bytes: 128
import sys
def main():
    for line in sys.stdin:
        a = list(map(int, line.split()))
        b = list(map(int, input().split()))

        hi, bl = 0, 0
        for x in range(4):
            for y in range(4):
                if a[x] == b[y]:
                    if x == y:
                        hi += 1
                    else:
                        bl += 1

        print(hi, bl)


if __name__ == "__main__":
    main()

Measured memory_bytes: 7612
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <algorithm>
#include <math.h>
#include <time.h>
#include <vector>
#include <map>
#include <set>
using namespace std;
int a[3][1001];
int f[3][1001];
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n;
	cin>>n;
	for(int i=1;i<=2;i++)
	{
		for(int j=1;j<=n;j++)
		cin>>a[i][j];
	}
	for(int i=1;i<=2;i++)
	{
		for(int j=1;j<=n;j++)
		{
			f[i][j]=max(f[i-1][j],f[i][j-1])+a[i][j];
		}
	}
	cout<<f[2][n];
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, m, n) for(int i = (m); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)
#define PI (acos(-1))
#define mp make_pair
#define pb push_back
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl

template<class T> inline bool chmin(T& a, T b) 
{ if (a > b) { a = b; return true; } return false; }

template<class T> inline bool chmax(T& a, T b) 
{ if (a < b) { a = b; return true; } return false; }

template<class T> inline auto __lcm(T& a, T& b) 
{ return a * b / __gcd(a, b); }

int main() {
    string S;
    int K;
    cin >> S >> K;

    set<string> s;
    rep(i, S.size()) {
        rep(j, K) {
            s.insert(S.substr(i, j+1));
        }
    }
    
    auto itr = next(s.begin(), K-1);
    print(*itr);

    return 0;
}


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

const int N = 55;

char s[N][N];
int ps[4][2] = {0,1,0,-1,1,0,-1,0};

int main ()
{
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; ++i) cin >> s[i] + 1;
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= m; ++j) {
            if (s[i][j] == '#') {
                bool flag = false;
                for (int k = 0; k < 4; ++k) {
                    int dx = i + ps[k][0], dy = j + ps[k][1];
                    if (i < 1 || j < 1 || i > n || j > m) continue;
                    if (s[dx][dy] == '#') flag = true;
                }
                if (flag == false) {
                    puts("No");
                    return 0;
                }
            }
        }
    }
    puts("Yes");
    return 0;
}


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


int main(int argc, char const *argv[])
{
    int A;
    int B;
    int C;
    cin>>A>>B>>C;
    
    
    if (A<=C&&B>=C) {
        cout<<"Yes";
    }
    else
    {
        cout<<"No";
    }
    
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
static const int INF (1<<30);

int main() {
  int N, K, Q; cin >> N >> K >> Q;
  vector<int> ac(N, 0);
  rep(i, Q) {
    int ain;
    cin >> ain;
    ac[ain-1]++;
  }


  rep(i, N) {
    if (K-Q+ac[i] > 0) cout << "Yes" << endl;
    else cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	vector<vector<int> >  A(N, vector<int>(N));
	int res = 0;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			cin >> A[i][j];
		}
	}
	vector<int> dp(1 << N, 0);
	vector<int> sum(1 << N, 0);
	vector<int> T;
	for (int i = 0; i < (1 << N); i++) {
		T.clear();
		for (int j = 0; j < N; j++) {
			if (i & (1 << j)) {
				T.push_back(j);
			}
		}
		sum[i] = 0;
		for (int j = 0; j < T.size(); j++) {
			for (int k = 0; k < j; k++) {
				sum[i] += A[T[j]][T[k]];
			}
		}
	}
	for (int z = 0; z < (1 << N); z++) {
		for (int y = 0; ; y = (y - z) & z) {
			dp[z] = max(dp[z], dp[y] + sum[z ^ y]);
			if (y == z) break;
		}
	}
	cout << dp[(1 << N) - 1] << endl;
}

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

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

	int N;
	int i,j;
	int tmp;
	int answer;
	int counter=0;
	double ave;
	string given;

	cin >> N >> given;

	for(i=0;i<N-2;i++){
		if(given[i]=='A' && given[i+1]=='B' && given[i+2]=='C') counter++;
	}

	//sort(given.begin(),given.end());
	//sort(given.begin(),given.end(),greater<int>());
	
	answer=counter;
	cout << answer << endl;

	return 0;
}



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

int main()
{
    int a, b, h, m;
    cin >> a >> b >> h >> m;

    const double angleA = (360.0 / 12) * h + (360.0 / (12 * 60)) * m;
    const double angleB = 360.0 * m / 60;
    const double angle = angleA - angleB;

    const double c = a * a + b * b - 2 * a * b * cos(angle * M_PI / 180.0);
    printf("%.20f\n", sqrt(c));
    return 0;
}

Measured memory_bytes: 4160
def main():
  #n = int(input())
  s = list(input())
  #s = input().split()
  #a,b = list(map(int,input().split()))
  #a = [input() for i in range(n)]
  #a = [int(input()) for i in range(n)]
  #a = [input().split() for i in range(n)]
  #a = [list(map(int,input().split())) for i in range(n)]
  ans = 0
  count = 0
  lis = []
  
  if s[2] == s[3] and s[4] == s[5]:
    print("Yes")
  else:
    print("No")
  

if __name__ == '__main__':
  main()

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
inline int read()
{
	int ret=0,w=1;
	char ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-') w=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9') ret=ret*10+ch-'0',ch=getchar();
	return w*ret;
}
int n;
bool check(int x)
{
	for(int i=2;i*i<=x;i++)
	if(x%i==0) return 0;
	return 1;
}
int main()
{
	cin>>n;
	for(;;n++)
	if(check(n))
	{
		cout<<n<<endl;
		return 0;
	}
	return 0;
}

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

#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repk(i,m,n) for(int i=m;i<n;i++)
typedef long long ll;
using namespace std;
int main()
{
    string s;
    while(cin>>s)
    {
        if(s=="Sunny")
            cout<<"Cloudy";
        else if(s=="Cloudy")
            cout<<"Rainy";
        else
            cout<<"Sunny";
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = a; i < b; ++i)
#define all(c) c.begin(), c.end()
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define gadd(x,y) x=add(x,y)
#define gmul(x,y) x=mul(x,y)
using namespace std;

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

const int N = 2e5 + 5;
int cnt[N];

int main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(0);
	int n;
	cin >> n;
	rep(i,0,n-1){
		int x;
		cin >> x;
		++cnt[x];
	}
	rep(i,1,n+1)cout << cnt[i] << '\n';
}


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

void solve() {
	int n;
	cin>>n;
	unordered_set<string> s;
	while(n--) {
		string c;
		cin>>c;
		s.insert(c);
	}
	cout<<s.size()<<"\n";
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout.precision(10);
    cout<<fixed;
#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
#endif
	solve();
	return 0;
}

Measured memory_bytes: 17692
// warm heart, wagging tail,and a smile just for you!
//                                                                     ███████████
//                                                                   ███╬╬╬╬╬╬╬╬╬╬███
//                                                                ███╬╬╬╬╬████╬╬╬╬╬╬███
//                                            ███████████       ██╬╬╬╬╬████╬╬████╬╬╬╬╬██
//                                      █████████╬╬╬╬╬████████████╬╬╬╬╬██╬╬╬╬╬╬███╬╬╬╬╬██
//                               ████████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬██╬╬╬╬╬╬╬██
//                             ████╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬╬╬╬╬╬██
//                           ███╬╬╬█╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬███╬╬╬╬╬╬╬█████
//                         ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬████████╬╬╬╬╬██
//                       ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬╬╬╬╬███
//                     ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬██
//                 ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬████
//     █████████████╬╬╬╬╬╬╬╬██╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬██████
//   ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬██████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████╬╬╬╬╬╬╬███████████╬╬╬╬╬╬╬╬██╬╬╬██╬╬╬██
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬█╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬██
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬▓▓▓▓▓▓╬╬╬████╬╬████╬╬╬╬╬╬╬▓▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬███
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬█████
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████████
//   ███╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
//       ██████████████  ████╬╬╬╬╬╬███████████████████████████╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████
//                         ███████                           █████  ███████████████████  
//
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF (1LL<<60)
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
#define MSB(x) (63-__builtin_clzll(x))
#define pcnt(x) (__builtin_popcountll(x))
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

  int n;
  string s;
  cin >> n >> s;

  if(n%2==0 && s == s.substr(0,n/2)+s.substr(0,n/2)) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

        if (a < b && b < c) {
            System.out.println("Yes");

        } else {
            System.out.println("No");

        }
    }
}



Measured memory_bytes: 26240
import Foundation

func readInts() -> [Int] {
    readLine()!.split(separator: " ").map { Int($0)! }
}

func main() {
    let nm = readInts()
    let (n,m) = (nm[0],nm[1])
    
    print(n * (n - 1) / 2 + m * (m - 1) / 2 )
    
}

main()


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

namespace AizuOnlineJudge
{
    class Program
    {
        static void Main(string[] args)
        {
            var left = new Stack<int>();
            var puddle = new Stack<Puddle>();

            var s = Console.ReadLine();
            var sumS = 0;
            for (var i = 0; i < s.Length; ++i)
            {
                var c = s[i];
                switch (c)
                {
                    case '\\':
                        left.Push(i);
                        break;
                    case '/':
                        if (!left.Any()) break;
                        var leftIndex = left.Pop();
                        var nowS = i - leftIndex; sumS += nowS;
                        while (puddle.Any())
                        {
                            var e = puddle.Pop();
                            if (leftIndex < e.Left)
                                nowS += e.S;
                            else
                            {
                                puddle.Push(e);
                                break;
                            }
                        }
                        var p = new Puddle { Left = leftIndex, S = nowS };
                        puddle.Push(p);
                        break;
                }
            }
            var list = puddle.Reverse().ToList();
            Console.WriteLine(sumS);
            var sep = list.Any() ? " " : "";
            Console.WriteLine($"{list.Count}{sep}{string.Join(" ", list.Select(e => e.S))}");
        }
    }

    struct Puddle
    {
        public int Left;
        public int S;
    }
}


Measured memory_bytes: 20888
#include <iostream>
#include <algorithm>

using namespace std;

typedef long long ll;

#define REP(i, n) for (ll i = 0; i < n; ++i)
#define FOR(i, n, m) for (ll i = n; i < m; ++i)

const int MAX = 1010;
const int M = 39;
const ll SUM_D = (1l << M)-1;
int N;
ll U[MAX], V[MAX];
string MODE[4];

int main() {

  cin >> N;

  int even = 0;
  REP (i, N) {
    ll x, y;
    cin >> x >> y;
    U[i] = x+y;
    V[i] = x-y;
    even |= 1<<(abs(U[i])%2);
  }

  MODE[3] = "R";
  MODE[2] = "U";
  MODE[1] = "D";
  MODE[0] = "L";

  if (even == 3) {
    cout << -1 << endl;
    return 0;
  }

  even %= 2;
  if (even) {
    cout << M+1 << endl;
    cout << "1 1";
  } else {
    cout << M << endl;
    cout << 1;
  }
  REP (i, M-1) cout << " " << (1l<<(i+1));
  cout << endl;

  REP (n, N) {
    ll u = U[n], v = V[n];
    if (even) {
      u++; v++;
      cout << "L";
    }

    bool pU = (u >= 0), pV = (v >= 0);
    ll dU = SUM_D - abs(u);
    ll dV = SUM_D - abs(v);
    FOR (m, 1, M+1) {
      int c = ((((dU>>m)&1)^pU)<<1) + ((dV>>m)&1)^pV;
      cout << MODE[c];
    }
    cout << endl;
  }

  return 0;

}

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

int main(void) {
    io;
    int inp; cin >> inp;
    int bal = inp % 1000;
    cout << ((bal) ? 1000-bal : bal);
    return 0;
}

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

// repetition
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

// container util
#define all(x) (x).begin(), (x).end()

// typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

// const value
// const ll MOD = 1e9 + 7;
// const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
// const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

// conversion
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
inline ll toLL(string s) {
  ll v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T> inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

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() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  VLL a(n);
  rep(i, n) cin >> a[i];
  int mcnt = 0;
  VLL absA;
  ll ans = 0;
  rep(i, n) {
    absA.push_back(abs(a[i]));
    ans += abs(a[i]);
    if(a[i] < 0)
      mcnt++;
  }
  sort(all(absA));
  // rep(i, n) cout << absA[i] << " ";
  // cout << endl;
  // cout << ans << " " << absA[0] << endl;
  if(mcnt % 2) {
    cout << ans - 2LL * absA[0] << endl;
  } else {
    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 5044
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int h,w;
bool vis[105],ans[105];
char s[105][105];
int main() {
     
    cin>>h>>w;
    for(int i=1;i<=h;i++)
        for(int j=1;j<=w;j++) {
            cin>>s[i][j];
        }
    for(int i=1,flag=0;i<=h;i++,flag=0) {
        for(int j=1;j<=w;j++) {
            if(s[i][j]=='#')
                {   
                    flag=1;
                    break;
                }
            }
                if(!flag)
                vis[i]=1;
        }
    for(int i=1,flag=0;i<=w;i++,flag=0) {
        for(int j=1;j<=h;j++) {
            if(s[j][i]=='#') {
                flag=1;
                break;
            }

        }
           if(!flag)
            ans[i]=1;
    }
    for(int i=1;i<=h;i++){
        if(vis[i])
        continue;
       for(int j=1;j<=w;j++)
       { if(ans[j])
        continue;
        cout<<s[i][j];
        }
        cout<<endl;
    }

}

Measured memory_bytes: 256
import java.awt.Point;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        List<List<Integer>> edge = new ArrayList<>();
        for(int i = 0; i < n; i++) {
            edge.add(new ArrayList<>());
        }
        for(int i = 0; i < m; i++) {
            int u = Integer.parseInt(sc.next()) - 1;
            int v = Integer.parseInt(sc.next()) - 1;
            edge.get(u).add(v);
        }
        int[][] d = new int[n][3];
        for(int i = 0; i < n; i++) {
            for(int j = 0; j < 3; j++) {
                d[i][j] = -1;
            }
        }
        int s = Integer.parseInt(sc.next()) - 1;
        int t = Integer.parseInt(sc.next()) - 1;
        d[s][0] = 0;
        Queue<Point> que = new ArrayDeque<>();
        que.add(new Point(s, 0));
        boolean flag = true;
        loop : while(!que.isEmpty()) {
            Point p = que.poll();
            List<Integer> to = edge.get(p.x);
            for(int x : to) {
                if(x == t && (p.y + 1) % 3 == 0) {
                    System.out.println((p.y + 1) / 3);
                    flag = false;
                    break loop;
                }
                if(d[x][(p.y + 1) % 3] == -1) {
                    d[x][(p.y + 1) % 3] = p.y + 1;
                    que.add(new Point(x, p.y + 1));
                }
            }
        }
        if(flag) System.out.println(-1);
    }
}

Measured memory_bytes: 73028
#include<bits/stdc++.h>
#define enld '\n'
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr double INFD = 1e100;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
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; }
// ios::sync_with_stdio(false);
// cin.tie(nullptr);
// ---------------------------------------------------------------------------

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

int main(){
    int N;
    cin >> N;
    vector<int> A(N+1);
    for(int i=0; i<=N; i++){
        cin >> A[i];
    }
    sort(A.begin(),A.end());
    int ans = A[1] - A[0];
    for(int i=2; i<=N; i++){
        ans = gcd(ans,A[i]-A[i-1]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include<iostream>

using namespace std;
int main(){
 
  
int A,B,C;
cin >> A >> B >> C;                      
if(A==5 && B==5 && C==7){
cout << "YES" << endl;
}else if(A==5 && B==7 && C==5){
cout << "YES" << endl;
}else if(A==7 && B==5 && C==5){
cout << "YES" << endl;
 }else {
   
      cout << "NO" << endl;
  }
  
     
   return 0;
}


Measured memory_bytes: 256
function Main(input) {
  const inputs = input.split('\n')
    .filter(v => v);
  const n = Number(inputs[0]);
  const strs = inputs[1]
    .split('');
  
  console.log(strs.map(function(s) {
    var c = s.charCodeAt() + n;
    if (c > 90) {
      c -= 26;
    }
    return String.fromCharCode(c)
  }).join('') + '\n');
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7500
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>

#define REP(i, n) for (int i = 0; i < n; ++i)
#define FOR(i, x, n) for (int i = x; i < n; ++i)

typedef std::vector<int> v;
typedef std::vector<std::vector<int>> vv;
typedef unsigned long long ull;

int main(void)
{
    double a, b, h1, h2;
    scanf("%lf %lf %lf %lf", &a, &b, &h1, &h2);
    double m = h1 * 60. + h2;

    printf("%.16Lf\n", sqrtl(a * a + b * b - 2 * a * b * cos(M_PI / 30 * m - M_PI / 360 * m)));
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
#define MN 200005
inline int read(){
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+ch-'0';ch=getchar();}
	return x*f;
}
int x1,x2,yy,y2,cnt,lis[MN],len;bool k;
struct fountain{int x,y;}a[MN];
bool cmp(const fountain &a,const fountain &b){return a.x<b.x;}
int g(int x,bool kk){return kk?1e8-x:x;}
int main(){
	x1=read(),yy=read();
	x2=read(),y2=read();
	if(x1>x2) swap(x1,x2),swap(yy,y2);
	if(y2<yy) k=1,x1=g(x1,1),x2=g(x2,1),swap(x1,x2),swap(yy,y2);
	int n,x,y; n=read();
	while(n--){
		x=g(read(),k),y=read();
		if(x<x1||x>x2||y<yy||y>y2) continue;
		a[++cnt]=(fountain){x,y};
	}
	sort(a+1,a+cnt+1,cmp);
	memset(lis,0x3f,sizeof lis);
	for(int i=1;i<=cnt;i++){
	    int p=lower_bound(lis,lis+len,a[i].y)-lis;
	    lis[p]=a[i].y;
	    if(p==len)  len++;
	}
	//printf("%.15lf",len*5*acos(-1)-20*len+900);
	if(min(abs(x1-x2),abs(yy-y2))+1==len) printf("%.15lf",abs(x1-x2)*100.+abs(yy-y2)*100.+len*5*acos(-1)-20*len+acos(-1)*5);
	else printf("%.15lf",abs(x1-x2)*100.+abs(yy-y2)*100.+len*5*acos(-1)-20*len);
	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
struct node
{
	int u,v,next;
};
node t[100010];
int n,m,head[100010],f[100010],ans,ind[100010],b[100010],tp[100010],cnt;
void build(int x1,int y1,int tot)
{
	t[tot].u=x1;
	t[tot].v=y1;
	t[tot].next=head[x1];
	head[x1]=tot;
}
void topo()
{
	queue <int> q;
    for(int i=1;i<=n;i++)
        if(!ind[i]) 
			q.push(i);
    while(!q.empty())
    {
        int p=q.front();
		q.pop();
        tp[++cnt]=p;
        for(int i=head[p];i;i=t[i].next)
        {
            int y=t[i].v;
            ind[y]--;
            if(!ind[y])
                q.push(y);  
        }
    }
}
int main()
{
	cin>>n>>m;
	for(int i=1;i<=m;i++)
	{
		int x1,y1;
		cin>>x1>>y1;
		build(x1,y1,i);
		ind[y1]++;
	}
	topo(); 
	for(int i=1;i<=n;i++)
	{
		for(int j=head[tp[i]];j;j=t[j].next)
		{
			f[t[j].v]=max(f[t[j].v],f[tp[i]]+1);
		}
		ans=max(ans,f[tp[i]]);
	}
//	for(int i=1;i<=n;i++)
//		cout<<tp[i]<<' ';
//	cout<<endl; 
	cout<<ans<<endl;
	return 0;
}


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

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

	if (n % 2 == 0) {
		cout << n / 2 << endl;
	}
	else if (n % 2 == 1) {
		cout << n / 2 + 1 << endl;
	}

	cin.get();
    cin.get();
    return 0;
}

Measured memory_bytes: 256
//* AuThOr GaRyMr *//
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define niv vector<int>
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define KEEP while(1)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
#define ff fflush(stdout)
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
int main(){
	string s;
	cin>>s;
	int len=s.length();
	int tot=15-len;
	rep(i,len) if(s[i]=='o') tot++;
	if(tot>=8) cout<<"YES";
	else cout<<"NO";
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
string S;
int main(){
    cin>>S;
    if (S.front()== 'A'){
        int a=0;
        for (int i=2; i<=S.size()-2; i++){
            if (S[i]=='C')a++;
        }
        if (a==1){
            a=0;
            for (int i=0; i<S.size(); i++){
                a += (S[i]>='a' && S[i]<='z');
            }
            if (a+2 == S.size()){cout<<"AC";return 0;}
        }

    }cout<<"WA";
    return 0;
}

Measured memory_bytes: 256
#n=int(input())
n,k=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
ans=0
import fractions
newval=n%k
if n>=k:
    ans=min(n%k,abs(k-n%k))
else:
    ans=min(k-n,n)
print(ans)

Measured memory_bytes: 5560
#include<stdio.h>
int F[44];

void fibonacci(int n){
  int i;
  
  F[0] = 1;
  F[1] = 1;
  
  for(i = 2; i <= n; i++)
    F[i] = F[i - 2] + F[i - 1];
}

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

  fibonacci(n);
  
  printf("%d\n", F[n]);
  
  return 0;
}



Measured memory_bytes: 2108
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<functional>
#include<queue>
#include <iomanip>
#include<map>
#include<limits>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<utility>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>

#define DBG cerr << '!' << endl;
#define REP(i,n) for(int (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(int (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(int (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int i = 0;i < (n);i++)cerr << v[i] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

int main()
{
	int n;cin >> n;
	vector<int> v(n);
	REP(i,n)cin >> v[i];
	
	sort(ALL(v));
	
	ll sum = 0;
	int ans = 0;
	REP(i,n)
	{
		if(sum * 2 < v[i])
			ans = i;
		sum += v[i];
	}
	
	cout << n - ans << endl;
	 
	
	return 0;
}

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

/*
How to use:
- input :   std::string
- output :  std::vector<std::pair<char, long long>>
    - first:    character
    - second:   count

Note that any element of input must not be -1.
*/
vector<pair<char,ll>> run_length_encoding(string s){
    vector<pair<char,ll>> res;
    ll n = s.size();
    char prev = -1;
    ll cur = 1;
    for(ll i = 0; i < n; i++) {
        if(prev == s[i]) cur++;
        else {
            if(prev != -1) res.push_back({prev, cur});
            prev = s[i];
            cur = 1;
        } 
    }
    res.push_back({prev, cur});
    return res;
}

int main(){
    string s;
    cin >> s;
    ll n = s.size();
    ll cnt = 0;
    char cur = 'R';
    s.push_back('R');
    vector<ll> ans(n+19, 0);
    rep(i, 0, n+1) {
        if(cur == s[i]) cnt++;
        else {
            if(cur == 'R') {
                ans[i] += cnt / 2;
                ans[i-1] += (cnt + 1) / 2;
                cur = 'L';
                cnt = 1;
            } else {
                ans[i-cnt] += (cnt + 1) / 2;
                ans[i-cnt-1] += cnt / 2;
                cur = 'R';
                cnt = 1;
            }
        }
    }
    rep(i, 0, n) cout << ans[i] << (i == n-1 ? "\n" : " ");
    return 0;
}

Measured memory_bytes: 4248