akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

ll mo=924844033;

int N;
vector<int> E[202020];
int C[202020];
int A[202020];
ll fact[202020];

ll combi(ll N_, ll C_) {
	const int NUM_=400001;
	static ll fact[NUM_+1],factr[NUM_+1],inv[NUM_+1];
	if (fact[0]==0) {
		inv[1]=fact[0]=factr[0]=1;
		for (int i=2;i<=NUM_;++i) inv[i] = inv[mo % i] * (mo - mo / i) % mo;
		for (int i=1;i<=NUM_;++i) fact[i]=fact[i-1]*i%mo, factr[i]=factr[i-1]*inv[i]%mo;
	}
	if(C_<0 || C_>N_) return 0;
	return factr[C_]*fact[N_]%mo*factr[N_-C_]%mo;
}

void dfs(int cur,int pre) {
	C[cur]=1;
	FORR(r,E[cur]) if(r!=pre) dfs(r,cur),C[cur]+=C[r];
}

ll modpow(ll a, ll n = mo-2) {
	ll r=1;
	while(n) r=r*((n%2)?a:1)%mo,a=a*a%mo,n>>=1;
	return r;
}
vector<ll> fft(vector<ll> v, bool rev=false) {
	int n=v.size(),i,j,m;
	
	for(i=0,j=1;j<n-1;j++) {
		for(int k=n>>1;k>(i^=k);k>>=1);
		if(i>j) swap(v[i],v[j]);
	}
	for(int m=2; m<=n; m*=2) {
		ll wn=modpow(5,(mo-1)/m);
		if(rev) wn=modpow(wn);
		for(i=0;i<n;i+=m) {
			ll w=1;
			for(int j1=i,j2=i+m/2;j2<i+m;j1++,j2++) {
				ll t1=v[j1],t2=w*v[j2]%mo;
				v[j1]=t1+t2;
				v[j2]=t1+mo-t2;
				while(v[j1]>=mo) v[j1]-=mo;
				while(v[j2]>=mo) v[j2]-=mo;
				w=w*wn%mo;
			}
		}
	}
	if(rev) {
		ll rv = modpow(n);
		FOR(i,n) v[i]=v[i]*rv%mo;
	}
	return v;
}

vector<ll> MultPoly(vector<ll> P,vector<ll> Q,bool resize=false) {
	if(resize) {
		int maxind=0,pi=0,qi=0,i;
		int s=2;
		FOR(i,P.size()) if(norm(P[i])) pi=i;
		FOR(i,Q.size()) if(norm(Q[i])) qi=i;
		maxind=pi+qi+1;
		while(s*2<maxind) s*=2;
		P.resize(s*2);Q.resize(s*2);
	}
	P=fft(P), Q=fft(Q);
	for(int i=0;i<P.size();i++) P[i]=P[i]*Q[i]%mo;
	return fft(P,true);
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	FOR(i,N-1) {
		cin>>x>>y;
		E[x-1].push_back(y-1);
		E[y-1].push_back(x-1);
	}
	dfs(0,-1);
	FOR(x,N) if(C[x]!=N) A[C[x]]++,A[N-C[x]]++;
	
	vector<ll> P(1<<19),Q(1<<19);
	fact[0]=1;
	FOR(i,N+1) fact[i+1]=fact[i]*(i+1)%mo;
	
	for(i=0;i<=N;i++) {
		P[i] = A[i]*fact[i];
		Q[N-i] = modpow(fact[i]);
	}
	vector<ll> R=MultPoly(P,Q);
	
	for(i=1;i<=N;i++) {
		ll ret=N*combi(N,i)%mo;
		ret -= R[N+i-0]*modpow(fact[i])%mo;
		cout<<(ret%mo+mo)%mo<<endl;
	}
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


Measured memory_bytes: 50036
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define endl "\n"
#define ull unsigned long long
#define ALL(v) ((v).begin()), ((v).end())
#define INCREASING(v) sort(ALL(v))
#define DECREASING(v) INCREASING(v), reverse(ALL(v))
#define SZ(v)   ((int)((v).size()))
#define LP(c,x,n)  for(int c=x;c<n;c++)
#define LO(c,n,x)  for(int c=n;c>=x;c--)
#define watch(x) cout << (#x) << " is " << (x) << endl
#define PB push_back
#define F first
#define S second
#define STP(x) setprecision(x)
#define MP make_pair
#define PI ( 2 * acos(0.0))
#define EPS 1e-8
#define INF 1.0/0.0
#define Yala_Besor3a ios_base::sync_with_stdio(0),ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define ReadFile freopen("delivery.in","r",stdin)
#define WriteFile freopen("output.txt","w",stdout)
using namespace std;
const int OO = 0x3f3f3f3f,NegOO= -1*OO,N =3e3+5,mod =1e9+7 ;
double dp[N][N];
int n;
double P[N];
double solve(int i,int numhead,int numtail)
{
    if(i==n)return (numhead>numtail);
    double &rf=dp[i][numhead];
    if(rf!=-1.0)return rf;
    rf=(P[i]*solve(i+1,numhead+1,numtail))+((1-P[i])*solve(i+1,numhead,numtail+1));
    return rf;
}
int main()
{
    //Yala_Besor3a;
    cin>>n;
    LP(c,0,n)cin>>P[c];
    LP(c,0,N)LP(i,0,N)dp[c][i]=-1;
    cout<<fixed<<setprecision(10)<<solve(0,0,0)<<endl;
    return 0;
}

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

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

    vector<char> ans;
    ans.push_back(s[0]);
    rep(i,n-1) {
        if (s[i] != s[i+1]) ans.push_back(s[i+1]);
    }
    cout << ans.size() << endl;

    return 0;
}

Measured memory_bytes: 640
#include<stdio.h>
#define MAX 10000
#define NIL -1

struct Node{
  int p, l, r;
};

struct Node T[MAX];
int n,D[MAX],H[MAX];


void setDepth(int u,int d){
  if(u==NIL)return;
  D[u]=d;
  setDepth(T[u].l,d+1);
  setDepth(T[u].r,d+1);
}

int setHeight(int u){
  int h1 =0,h2 = 0;
  if(T[u].l!=NIL){
    h1=setHeight(T[u].l)+1;
  }
  if(T[u].r!=NIL){
    h2=setHeight(T[u].r)+1;
  }
    return H[u]=(h1 > h2 ? h1 : h2);
}


int getSibling(int u){
  if ( T[u].p == NIL ) return NIL;
  if ( T[T[u].p].l != u && T[T[u].p].l != NIL ) return T[T[u].p].l;
  if ( T[T[u].p].r != u && T[T[u].p].r != NIL ) return T[T[u].p].r;
  return NIL;
}

void print(int u){
  printf("node %d: ", u);

  printf("parent = %d, ", T[u].p);
  printf("sibling = %d, ", getSibling(u));
  int deg = 0;
  if ( T[u].l != NIL ) deg++;
  if ( T[u].r != NIL ) deg++;
  printf("degree = %d, ", deg);
  printf("depth = %d, ", D[u]);
  printf("height = %d, ", H[u]);

  if ( T[u].p == NIL ){
    printf("root\n");
  } else if ( T[u].l == NIL && T[u].r == NIL ){
    printf("leaf\n");
  } else {
    printf("internal node\n");
  }
}

int main(){
  int i,v,l,r,root=0;
  scanf("%d",&n);

  for(i=0;i<n;i++){
    T[i].p=NIL;
  }
  for(i=0;i<n;i++){
    scanf("%d %d %d",&v,&l,&r);
    T[v].l=l;
    T[v].r=r;
    if(l!=NIL)T[l].p=v;
    if(r!=NIL)T[r].p=v;
  }
  for(i=0;i<n;i++)if(T[i].p==NIL)root=i;
  setDepth(root,0);
  setHeight(root);

  for(i=0;i<n;i++){
    print(i);
  }
  return 0;
}



Measured memory_bytes: 2056
#include<stdio.h>
int main(void){
   int n;
   int a;
   int b[100]; 
  
   scanf("%d",&n);
  
  for (a = 0; a < n; a++) { 
    scanf("%d", &b[a]); 
  }
 for (a = 0; a < n; a++) { 
   if (b[a] % 2 == 0 && b[a] % 3 != 0 && b[a] % 5 != 0) { 
     printf("DENIED"); 
     return 0; 
   } 
 } 
  puts("APPROVED");

  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;

ll INF = 1000000007;

// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main() {
    int n;
    cin >> n;
    vector<int> cnt(n);
    rep(i, n) {
        int k;
        cin >> k;
        cnt[k]++;
    }
    if (n % 2 == 0) {
        bool flag = true;
        for (int i = 1; i < n; i += 2) {
            if (cnt[i] != 2) flag = false;
        }
        if (flag) {
            cout << modpow((ll)2, n/2, INF) << endl;
        }
        else {
            cout << 0 << endl;
        }
    }
    else {
        bool flag = true;
        if (cnt[0] != 1) flag = false;
        for (int i = 2; i < n; i += 2) {
            if (cnt[i] != 2) flag = false;
        }
        if (flag) {
            cout << modpow((ll)2, n/2, INF);
        }
        else {
            cout << 0 << endl;
        }
    }
}

Measured memory_bytes: 640
import math
n, d = map(int, input().split())
points = [0]*n

for i in range(n):
	points[i] = tuple(map(int, input().split()))

count = 0 
for i in range(n-1):
	for j in range(i+1, n):
		dist = math.sqrt(sum(pow(points[i][k] - points[j][k], 2) for k in range(d)))
		if dist == int(dist):
			count += 1
print(count)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
if(a%3==0 or b%3==0 or (a+b)%3==0){
	cout<<"Possible"<<endl;
}else{
	cout<<"Impossible"<<endl;
}
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
#define F first
#define S second
#define pb push_back
mt19937 rnd;


int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif

    int task, n;
    cin >> task >> n;
    int sum = 0;
    for (int i=1; i<=n; i++) {
        int a;
        cin >> a;
        sum += a;
    }
    if (sum >= task) {
        cout << "Yes\n";
    }
    else {
        cout << "No\n";
    }

#ifdef LOCAL
    cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
   return 0;
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<bool> vb;
#define pb push_back
#define fi first
#define se second
#define in insert
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
void solve(){
    string s, t;
    cin >> s >> t;
    cout << t << s;
}
int main(){
    speed;
    int t = 1;
    //cin >> t;
    while(t--) solve();
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
#include <utility>
#include <set>
#include <stack>
#include <deque>
#include <ctime>
#include <random>
#include <cassert>
#include <cmath>
#include <climits>
#include <queue>
#include <cstring>
#include <bitset>
#include <iomanip>
#include <chrono>

/*
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("popcnt")
#pragma GCC target("avx2")
*/


#ifdef LOCAL
    #define dbg(x) cout << #x << " : " << x << endl;
#else 
    #define dbg(x)
#endif

#define int long long
#define pb push_back
#define ppb pop_back()
#define mp make_pair
#define fi(a,b) for (int i=a;i<b;i++)
#define fj(a,b) for (int j=a;j<b;j++)
#define fk(a,b) for (int k=a;k<b;k++)
#define fi1(a,b) for (int i=a-1;i>=b;i--)
#define fj1(a,b) for (int j=a-1;j>=b;j--)
#define fk1(a,b) for (int k=a-1;k>=b;k--)
#define fx(x,a) for (auto& x : a)
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define rep1(i, a, b) for (int i = a - 1; i >= b; --i)
#define siz(x) (int)x.size()
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

using namespace std;

template<typename T1, typename T2>inline void mine(T1 &x, T2 y) { if (x > y) x = y; }
template<typename T1, typename T2>inline void maxe(T1 &x, T2 y) { if (x < y) x = y; }

ostream& operator << (ostream &a, const vector<int> &b) {
    for (auto k : b) cout << k << ' ';
    return a;
}


typedef long long ll;
typedef unsigned long long ull;
typedef char ch;
typedef string str;
typedef pair<int, int> pii;
typedef map<int, int> mii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;
typedef vector<ch> vch;
typedef vector<vch> vvch;
typedef vector<str> vs;



const int MOD = 1000000007;
const int INF = 1000000050;
const long long BIG = (long long)2e18 + 50;
const int MX = 200010;
const double EPS = 1e-9;


mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
       
    int n, m;
    cin >> n >> m;
    ++n, ++m;
    vpii kek;
    fi(0, n - 1) {
        int x;
        cin >> x;
        kek.pb({x, 0});
    }      
    fi(0, m - 1) {
        int x;
        cin >> x;
        kek.pb({x, 1});
    }
    sort(all(kek));
    vi cnt(2, 0);
    vi len = {n, m};
    int ans = 0;
    for (auto[cost, id] : kek) {
        ans += cost * (len[id ^ 1] - cnt[id ^ 1]);
        ++cnt[id];
        dbg(ans);
    }
    cout << ans << '\n';
}

Measured memory_bytes: 7360
#include <iostream>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <utility>
#include <algorithm>
#include <set>
#include <queue>
#include <climits>
#include <limits>
#define inf 1000000000000000000

#define ll long long
#define max(A, B) ((A) > (B) ? (A) : (B))
#define min(A, B) ((A) < (B) ? (A) : (B))
#define pair(A, B) make_pair(A, B)

using namespace std;

typedef pair<int, int> pi;
typedef pair<pair<int, int>, int> pii;

void perform() {
  int n; cin >> n;
  double side1 = (double)n / 3;
  double side2 = (n - side1) / 2;
  double side3 = (n - side2 - side1);
  double prod = side1 * side2 * side3;
  cout << fixed << prod << endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll t = 1; //cin >> t;
  while (t--) {perform();}
}

Measured memory_bytes: 256
import math

def nCr(n,r):
    return math.factorial(n) // (math.factorial(n-r) * math.factorial(r) )


N,P = map(int,input().split())

A = list(map(int,input().split()))

E = 0
O = 0

for i in A:

    if i % 2 == 0:
        E += 1
    else:
        O += 1

ans = 1

ans *= 2**E


if P == 0:

    ans2 = 1

    for i in range(O // 2):

        i += 1
        i *= 2

        ans2 += nCr(O,i)

else:

    ans2 = 0

    for i in range((O+1) // 2):

        i *= 2
        i += 1

        ans2 += nCr(O,i)

print (ans * ans2)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define IOS                     \
    ios::sync_with_stdio(false);\
    cin.tie(0)

// *start on @date: 2020-05-10 20:14 

int main() 
{
    IOS;
    ll a[3],k;
    cin>>a[0]>>a[1]>>a[2]>>k;
    int ans=0;
    for(int i=0;i<3;i++)
    {
        if(a[i]<=k)
        {
            ans+=a[i]*(1-i);
            k-=a[i];
        }else
        {
            ans+=k*(1-i);
            k=0;
        }
    }
    cout<<ans;
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << endl; exit(0); }
inline void no() { cout << "No" << endl; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { x = max(x, y); }
template <typename T> inline void amin(T &x, T y) { x = min(x, y); }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

void solve() {
  int n, m, q;
  cin >> n >> m >> q;
  vector<vi32> sums(n + 1, vi32(n + 1));
  rep(i, m) {
    int l, r;
    cin >> l >> r;
    sums[l][r] += 1;
  }
  repc(i, n) rep(j, n) {
    sums[i][j + 1] += sums[i][j];
  }
  repc(j, n) rep(i, n) {
    sums[i + 1][j] += sums[i][j];
  }
  rep(i, q) {
    int p, q;
    cin >> p >> q;
    p -= 1;
    int ans = 0;
    ans = sums[q][q] - sums[p][q] - sums[q][p] + sums[p][p];
    cout << ans << '\n';
  }
}

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

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define st first
#define nd second
#define endl '\n'
#define what_is(x) cerr << #x << " is " << x << endl;
#define what_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << e << ' '; cerr << '\n'; //vector, set
#define what_is_a(x, n) cerr << #x << " is "; for(int i=0;i<n;i++) cerr << x[i] << ' '; cerr <<  '\n'; //n first element of array
#define cerr_pair(x) '{' << x.st << ", " << x.nd << '}'
#define pwhat_is(x) cerr << #x << " is " << cerr_pair(x) << endl;
#define pwhat_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << cerr_pair(e) << ' '; cerr << '\n'; //vector, set
#define pwhat_is_a(x, n) cerr << #x << " is "; for(int i=0;i<n;i++) cerr << cerr_pair(x[i]) << ' '; cerr <<  '\n'; //n first element of array
// #define int long long

typedef pair<int,int> pii;
const int N = 1e5+5;
const int INF = 1e9;
const int MOD = 1e9+7;

int h, n, sum;
int32_t main()
{
	IOS
	//freopen("input.txt", "r", stdin);
	cin >> h >> n;
	for(int i=0; i<n; i++){
		int a; cin >> a;
		sum += a;
	}
	puts(sum>=h?"Yes":"No");
	return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))

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

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

    def add(self, i, x):
        while i <= self.size:
            self.bit[i] += x
            i += i & -i
ok = 0
ng = 10**9+1

def inversion(a, bit):
    ans = 0
    for i, p in enumerate(b):
        bit.add(p, 1)
        ans += i+1 - bit.sum(p)
    return ans

while ng - ok > 1:
    m = ok + (ng-ok)//2
    b = [0]
    for i in range(n):
        if a[i] >= m:
            b.append(b[i]+1)
        else:
            b.append(b[i]-1)
    b = [i+100001 for i in b]
    bit = BIT(200005)
    inversion = 0
    for i, p in enumerate(b):
        bit.add(p, 1)
        inversion += i+1 - bit.sum(p)

    if inversion <= n*(n+1)//4:
        ok = m
    else:
        ng = m



print(ok)


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

using namespace std;
typedef long long ll;
const int maxn=205;
ll x[maxn],y[maxn];
const ll mod=998244353;

ll power_mod(ll a,ll b){
	ll ans=1;
	a%=mod;
	while(b){
		if(b&1) ans=(ans*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return ans;
}

ll gcd(ll a,ll b){
	return b==0?a:gcd(b,a%b);
}
map<pair<ll,ll>,ll>a;

int main(int argc, char const *argv[])
{
	ios::sync_with_stdio(false);
	int n;
	while(cin>>n){
		for(int i=1;i<=n;i++)
			cin>>x[i]>>y[i];
		ll ans=(power_mod(2,n)-1LL-n+mod)%mod;
		ll tmp1,tmp2,tmp;
		for(int i=1;i<=n;i++){
			a.clear();
			for(int j=i+1;j<=n;j++){
				tmp1=x[i]-x[j];
				tmp2=y[i]-y[j];
				tmp=gcd(tmp1,tmp2);
				tmp1/=tmp,tmp2/=tmp;
				a[make_pair(tmp1,tmp2)]++;
			}
			for(auto iter:a){
				ll temp=(power_mod(2,iter.second)-1+mod)%mod;
				ans=(ans-temp+mod)%mod;
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}

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

#define MOD (1000 * 1000 * 1000 + 7)
#define INF (1LL << 60)
#define pb push_back
#define po pop_back
#define fi first
#define se second

typedef long long ll;
typedef long double ld;

int main() {
    string str;
    cin >> str;

    vector<pair<char, int>> niz;
    niz.reserve(str.size());

    char c = str[0];
    int cnt = 0;
    for(auto &i : str) {
        if(c == i) {
            ++cnt;
        } else {
            niz.push_back({c, cnt});
            c = i;
            cnt = 1;
        }
    }
    niz.push_back({c, cnt});
    cout << niz.size() - 1 << endl;

    
    return 0;
}

Measured memory_bytes: 1280
# AOJ 0090: Overlaps of Seals
# Python3 2018.6.28 bal4u

EPS = 1.0e-8

def crossPoint(p1, p2):
	A = (p1.real-p2.real)/2
	B = (p1.imag-p2.imag)/2
	d = (A*A + B*B)**0.5
	if d*d > 1.0 + EPS: return;
	h = (1 - d*d)**0.5;
	k, X, Y = h/d, (p1.real+p2.real)/2, (p1.imag+p2.imag)/2;
	cross.append(complex(X+k*B, Y-k*A))
	cross.append(complex(X-k*B, Y+k*A))

while True:
	n = int(input())
	if n == 0: break
	circle = [0] * n
	for i in range(n):
		x, y = map(float, input().split(','))
		circle[i] = complex(x, y)
	cross = []
	for i in range(n):
		for j in range(i+1, n):	crossPoint(circle[i], circle[j]);
	ans = 0
	for i in cross:
		f = 0
		for j in circle:
			dx = j.real - i.real
			dy = j.imag - i.imag
			d = dx*dx + dy*dy
			if abs(d-1.0) <= EPS or d <= 1.0: f += 1
		if f > ans: ans = f
	print(1 if ans == 0 else ans)


Measured memory_bytes: 5724
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<utility>//swapでaとbの値を入れ替える
#define rep(i,n) for(int i=0;i<(n);i++)
#define ll long long
#define sort(s) sort(s.begin(),s.end())
#define r(s) reverse(s.begin(),s.end())
using namespace std;


int main() {
  int s[3];
  int x=0,y=0;
  rep(i,3){
  cin>>s[i];
  if(s[i]==5)x++;
  if(s[i]==7)y++;
  }
  
 if(x==2&&y==1)cout<<"YES"<<endl;
  
  
else  cout<<"NO"<<endl;
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define enum(i,x,y) for(int i=(x);i<=(y);++i)
#define try(i,x,y) for(int i=(x);i>=(y);--i)
void readint(int &x)
{
	x=0;int f=1;char c;
	for(c=getchar();!isdigit(c);c=getchar())if(c=='-')f=-1;
	for(;isdigit(c);c=getchar())x=x*10+c-'0';
	x*=f;
}
inline void chkmin(int &x,int y){x>y?x=y:0;}
inline void chkmax(int &x,int y){x<y?x=y:0;}
const int MAXN=35;

int n;char s[MAXN],str[MAXN];
bool vis[MAXN];

int main()
{
	#ifndef ONLINE_JUDGE
	//freopen("code.in","r",stdin);
	//freopen("code.out","w",stdout);
	#endif
	scanf("%s",s+1);n=strlen(s+1);
	if(n<26)
	{
		printf("%s",s+1);
		enum(i,1,n)vis[s[i]-'a']=1;
		enum(i,0,25)
			if(!vis[i]){putchar(i+'a');break;}
	}
	else
	{
		memcpy(str,s,sizeof(str));
		if(next_permutation(s+1,s+27))
		{
			enum(i,1,26)
			{
				putchar(s[i]);
				if(s[i]!=str[i])break;
			}
		}
		else printf("-1\n");
	}
	return 0;
}

Measured memory_bytes: 256
def main():
    n, *data = map(int, open(0).read().split())
    res = 'No'

    t, x, y = 0, 0, 0
    for i in range(n):
        u, a, b = data[i*3:(i+1)*3]
        dt = u - t
        dist = abs(a-x) + abs(b-y)

        if dt < dist or dt % 2 != dist % 2:
            break
        t, x, y = u, a, b
    else:
        res = 'Yes'

    print(res)


if __name__ == "__main__":
    main()


Measured memory_bytes: 26632
#include <stdio.h>
#include <cctype>
#include <limits.h>
#include <math.h>
#include <complex>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) static_cast<bitset<16> >(x)
#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 if_range(x, y, w, h) if (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()
const int INF = 1e9;
const double PI = 3.14159;
int dx[4]={0, 1, 0, -1}, dy[4]={-1, 0, 1, 0};
using namespace std;
typedef long long ll;
//typedef pair<int, int> P;

/* struct P {
	int x, y, n;
	P(int n, int x, int y):n(n), x(x), y(y){}
	P(){}
}; */


/** 幾何ライブラリ **/
// to do : 1183

#include <complex>

#define X real()
#define Y imag()

const double EPS = 1e-11;

typedef double D;
typedef complex<D> P; // Point

struct L { // Line
	P a, b;
	L(){}
	L(P aa, P bb) : a(aa), b(bb){}
};

// 共役複素数 conj(a);

// 符号
int sig(D a, D b=0) { return a < b - EPS ? -1 : (a > b + EPS ? 1 : 0); }

// 内積
D dot(P a, P b) { return (conj(a)*b).real(); }

// 外積
D cross(P a, P b) { return (conj(a)*b).imag(); }

// 線分abに対する点cの位置
enum CCW{LEFT=1, RIGHT=-1, BACK=2, FRONT=-2, ON=0};
int ccw(P a, P b, P c)
{
	b -= a, c -= a;
	D s = sig(cross(b, c));
	if (s) return s>0 ? LEFT : RIGHT;
	if (sig(dot(b, c))<0) return BACK;
	if (sig(abs(c), abs(b))>0) return FRONT;
	return ON;
}

// 直線abと点cの距離
D distLP(L l, P c)
{
	return abs(cross(l.b-l.a, c-l.a))/abs(l.b-l.a);
}

// 線分abと点cの距離
D distSP(L l, P c)
{
	if (sig(dot(l.b-l.a, c-l.a))<0) return abs(c-l.a);
	if (sig(dot(l.a-l.b, c-l.b))<0) return abs(c-l.b);
	return abs(cross(l.b-l.a, c-l.a))/abs(l.b-l.a);
}

// 線分と線分の交差判定
bool iSS(L s, L t)
{
	return (ccw(s.a, s.b, t.a) * ccw(s.a, s.b, t.b) <= 0)
			&& (ccw(t.a, t.b, s.a) * ccw(t.a, t.b, s.b) <= 0);
}


/** Problem CGL_1-C : Counter-Clockwise **/
int main()
{
	P a, b, c;
	cin>>a.X>>a.Y>>b.X>>b.Y;
	int q; cin>>q;
	rep(i, q) {
		cin>>c.X>>c.Y;
		int tmp = ccw(a, b, c);
		string ans="ON_SEGMENT";
		if (tmp==LEFT) ans="COUNTER_CLOCKWISE";
		if (tmp==RIGHT) ans="CLOCKWISE";
		if (tmp==BACK) ans="ONLINE_BACK";
		if (tmp==FRONT) ans="ONLINE_FRONT";
		cout << ans << endl;
	}
}

Measured memory_bytes: 1256
# include <bits/stdc++.h>
using namespace std;
typedef long long i64;
typedef vector<int> Vi;
typedef pair<int, int> Pii;
# define pb push_back
# define mp make_pair
# define MOD 1000000007
# define INF 1000000000
# define bug puts("H");
inline int Scan() {
    int x=0;int f=1; char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1; ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
    return x*f;
}

const int N = 100000 + 5;

int main ()
{
    i64 n;
    cin >> n;
    if (n <= INF) cout << 0 << " " << 0 << " " << 1000000000 << " " << 1 << " " << n << " " << 0 << endl;
    else {
        i64 x = INF - 1 - (n - 1) % INF;
        i64 y = (n - 1) / INF + 1;
        cout << 0 << " " << 0 << " " << 1000000000 << " " << 1 << " " << x << " " << y << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, s, n) for (int i = s; i < n; i++)
#define rp(i,n) for (int i=0;i<n;i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define all_acc(x) (x).begin(), (x).end(), 0LL
#define int long long
#define absSort(v) sort(a.begin(), a.end(), [](int i, int j) -> bool { return abs(i) < abs(j); });
using namespace std;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
using ll = long long;
double pi=3.14159265359;

//出力するよ
void output_tate(vector<int> s){
    int n = s.size();
    for (int i = 0; i < n; i++){
        //if (i != 0)
        //    cout << " ";
        cout << s[i]<<endl;
    }
    //cout << endl;
}

void output_yoko(vector<int> s){
    int n = s.size();
    for (int i = 0; i < n; i++){
        if (i != 0)
            cout << " ";
        cout << s[i];//<<endl;
    }
    cout << endl;
}

int MOD = pow(10, 9) + 7;

int kaijou(int n){
    if(n==0) return 1;
    else{
        return ((n%MOD)*(kaijou(n-1)%MOD))%MOD;
    }
}

bool ispow(int n){
    int rn=sqrt(n);
    if(rn*rn==n) return true;
    else return false;
}

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

    vector<int> mountain(n,0);

    int sum=accumulate(all(dam),0LL);
    vector<int> twomountain(n,0);
    int other_mountain=0;

    for(int i=0;i<n;i++){
        twomountain[i]=dam[i]*2;
    }

    int i=0;
    while((i)<(n-2)){
        other_mountain+=twomountain[i];
        i+=2;
    }
    int left=0,right=i-2;

    for(int i=0;i<n;i++){
        //cout<<left<<" "<<right<<endl;
        if(i==0){
            mountain[n-1]=sum-other_mountain;
        }else{
            mountain[left-1]=sum-other_mountain;
        }
        other_mountain-=twomountain[left];
        left+=2;
        right+=2;
        if(left>=n) left%=n;
        if(right>=n) right%=n;
        other_mountain+=twomountain[right];
    }

    output_yoko(mountain);
}


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

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

#define rep(i,n)    for(int i=0; i<(int)n; i++)
#define reps(i,s,e) for(int i=s; i<(int)e; i++)
#define coutd(i) cout << std::fixed << std::setprecision(i)
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, ll> pll;

template<class T>
using Graph = vector<vector<T>>;

const int INT_BIG = 1<<28;

int main() {
    string s;
    cin >> s;
    int l = s.length();
    int scount = 0;
    int tcount = 0;
    rep(i, l) {
        if (s[i] == 'S') {
            scount++;
        } else {
            if (scount > 0) {
                scount--;
            } else {
                tcount++;
            }
        }
    }
    cout << scount + tcount << endl;
}

Measured memory_bytes: 640
import Foundation

func gcd(_ A: Int, _ B: Int) -> Int {
  var a = A, b = B
  while b > 0 {
    var r = a % b; a = b; b = r
  }
  return a
}

let K = Int(readLine()!)!
var sum = 0
for a in 1...K {
  for b in 1...K {
    for c in 1...K {
      sum += gcd(a, gcd(b, c))
    }
  }
}
print(sum)

Measured memory_bytes: 13156
#include<iostream>
#include<cstdio>
#include<vector>
#include<queue>
#include<map>
#include<string>
#include <math.h>
#include<algorithm>
#include<functional>
#define ll long long
#define inf  999999999
#define pa pair<int,int>
#define EPS (1e-10)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

class Point{
	public:
	double x,y;
	Point(double x=0,double y=0):x(x),y(y) {}
	Point operator + (Point p) {return Point(x+p.x,y+p.y);}
	Point operator - (Point p) {return Point(x-p.x,y-p.y);}
	Point operator * (double a) {return Point(x*a,y*a);}
	Point operator / (double a) {return Point(x/a,y/a);}
	double absv() {return sqrt(norm());}
	double norm() {return x*x+y*y;}
	bool operator < (const Point &p) const{
		return x != p.x ? x<p.x: y<p.y;
	}
	bool operator == (const Point &p) const{
		return fabs(x-p.x)<EPS && fabs(y-p.y)<EPS;
	}
};
typedef Point Vector;

struct Segment{
Point p1,p2;
};


double dot(Vector a,Vector b){
	return a.x*b.x+a.y*b.y;
}
double cross(Vector a,Vector b){
	return a.x*b.y-a.y*b.x;
}

//----------------kokomade temple------------

double zz(Vector a,Vector b){
if(a.absv()<EPS || b.absv()<EPS) return 100;
else{
a=a/a.absv();
b=b/b.absv();
double co=dot(a,b),si=cross(a,b);
if(co<=-1+EPS) return 3.141592653590;
else if(si>0) return acos(co);
else if(co>1-EPS) return 0.0;
else return -acos(co);
}
 
}
 

int main(){
int n;
double r1,c21,c22,a1,a2,r2;
cin>>c21>>c22>>r1>>a1>>a2>>r2;
Point c1,c2;
c1.x=c21,c1.y=c22;
c2.x=a1,c2.y=a2;
Vector e;
e.x=1.0,e.y=0.0;
double t=zz(e,c2-c1),r12=(c2-c1).absv();
double q=acos((r1*r1-r2*r2+r12*r12+0.0)/(2.0*r12*r1));
Point ans1,ans2;
ans1.x=c1.x+r1*cos(t+q);
ans1.y=c1.y+r1*sin(t+q);
ans2.x=c1.x+r1*cos(t-q);
ans2.y=c1.y+r1*sin(t-q);

if(ans1.x<ans2.x  ||(ans1.x==ans2.x && ans1.y<ans2.y )){
printf("%.10f %.10f %.10f %.10f\n",ans1.x,ans1.y,ans2.x,ans2.y);
}
else printf("%.10f %.10f %.10f %.10f\n",ans2.x,ans2.y,ans1.x,ans1.y);
 

 
return 0;
}

Measured memory_bytes: 1280
S = str(input())
ans = 10**18
alp = list(set(S))

for i in alp:
  count = 0
  eff = 0
  for j in S:
    if i != j:
      count += 1
    else:
      eff = max(eff,count)
      count = 0
  eff = max(eff, count)
  ans = min(ans, eff)
  
print(ans)

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

template<typename T> T gcd(T a, T b) {
    if(!b) return a;
    return gcd(b, a % b);
}
template<typename T> T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

template<typename T> void chmin(T& a, T b) { a = (a > b) ? b : a; }
template<typename T> void chmax(T& a, T b) { a = (a < b) ? b : a; }
int in() { int x; scanf("%d", &x); return x; }

using namespace std;

typedef long long Int;
typedef unsigned long long uInt;
typedef unsigned uint;

int main(void) {
  long long N, K;
  cin >> N >> K;

  if (K > N) {
    cout << min(N, abs(N - K)) << "\n";
  } else {
    long long mult = (long long) (N / K);
    long long lower = abs(N - K * mult);
    long long upper = abs(N - K * (mult + 1));
    cout << min(N, min(lower, upper)) << "\n";
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  string s;
  cin >> s;
  rep(i,s.size()){
    s.at(i) = 'x';
  }
  cout << s << endl;
  }


Measured memory_bytes: 256
C = readlines.map{|l| l.split.map(&:to_i)}

require 'matrix'
a = Array.new(9){Array.new(9, 0)}
b = Array.new(9, 0)
C.flatten.each_with_index do |c, i|
  x, y = i.divmod(3)
  y += 3
  a[i][x] = 1
  a[i][y] = 1
  b[i] = c
end
m = Matrix[*a]
em = m.hstack(Matrix.column_vector(b))
puts m.rank == em.rank ? 'Yes' : 'No'

Measured memory_bytes: 4604
MOD = 998244353
n = int(input())
d = list(map(int, input().split()))
dist_map = [0]*n
for dist in d:
    dist_map[dist] += 1
ans = 1

if d[0] != 0 or dist_map[0] > 1:
    print(0)
    exit()

for i in range(1, n):
    ans *= pow(dist_map[i-1], dist_map[i], MOD)
    ans %= MOD
print(ans)



Measured memory_bytes: 14396
n = int(input())
A = []
for _ in range(n):
  x, y = map(int, input().split())
  A.append((x, y))
maxc = 0
for i in range(n):
  for j in range(n):
    c = 0
    if i == j:
      continue
    dx = A[i][0] - A[j][0]
    dy = A[i][1] - A[j][1]
    for k in range(n):
      for l in range(n):
        if k == l:
          continue
        if A[k][0] + dx == A[l][0] and A[k][1] + dy == A[l][1]:
          c += 1
    if maxc < c:
      maxc = c
print(n-maxc)
    
    



Measured memory_bytes: 73784
#include <bits/stdc++.h>
#define INF 1e9
#define all(v) v.begin(), v.end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define max(v) *max_element(v.begin(), v.end())
#define min(v) *min_element(v.begin(), v.end())
using namespace std;
     
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, q;
    cin>>n;
    int s[n];
    rep(i, n){
        cin>>s[i];
    }
    cin>>q;
    int t[q];
    rep(i, q){
        cin>>t[i];
    }
    int cnt = 0;
    rep(i, q){
        rep(j, n){
            if(s[j] == t[i]){
                cnt += 1;
                break;
            }
        }
    }
    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 3148
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);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; }

typedef long long ll;

using namespace std;
vector<map<ll,ll>>dp;
ll n,m;
vector<vector<ll>> edge;
ll dfs0(ll par,ll node)
{
  if(dp[node].count(par))return dp[node][par];
  ll res=1;
  for(auto nn:edge[node])
  {
    if(nn==par)continue;
    res=(ll)res*(dfs0(node,nn)+1)%m;
  }
  dp[node][par]=res;
  return res;
}
ll dfs(ll par,ll node)
{
  //cout<<par<<" "<<node<<endl;
  if(dp[node].count(par))return dp[node][par];
  if(edge[node].size()==1&&par!=-1)return 1;
  ll mul=1;
  vector<ll>lmul(edge[node].size()),rmul(edge[node].size());
  map<ll,int>ma;
  int cnt=0;
  for(auto itr=edge[node].begin();itr!=edge[node].end();itr++)
  {
    ma[*itr]=cnt++;
    lmul[ma[*itr]]=mul;
    mul=mul*(dfs(node,*itr)+1)%m;
  }
  mul=1;
  for(auto itr=edge[node].rbegin();itr!=edge[node].rend();itr++)
  {
    rmul[ma[*itr]]=mul;
    mul=mul*(dfs(node,*itr)+1)%m;
  }
  for(ll nn:edge[node])
  {
    dp[node][nn]=lmul[ma[nn]]*rmul[ma[nn]]%m;
  }
  if(par==-1)return dp[node][par]=mul;
  return dp[node][par];
}
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin>>n>>m;
  edge.resize(n);
  dp.resize(n);
  rep(i,n-1)
  {
    ll a,b;
    cin>>a>>b;
    a--;b--;
    edge[a].push_back(b);
    edge[b].push_back(a);
  }
  dfs0(-1,0);
  rep(i,n)
  {
    cout<<dfs(-1,i)<<"\n";
  }
  cout<<flush;
  return 0;

}


Measured memory_bytes: 42752
import java.util.*;

class Main{
	static int num;
	static int[] goals = new int[3];
	static int[] lens;

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		num = sc.nextInt();
		lens = new int[num];
		for(int i = 0; i < 3; i++) goals[i] = sc.nextInt();
		for(int i = 0; i < num; i++) lens[i] = sc.nextInt();
		sc.close();
		int result = dfs(0, 0, 0, 0);
		System.out.println(result);
	}

	static int dfs(int index, int a, int b, int c) {
		int ans[] = new int[4];
		if(index == num) {
			if(Math.min(a,Math.min(b,c)) <= 0) {
				return 1000000000;
			}
			return Math.abs(goals[0] - a) + Math.abs(goals[1] - b) + Math.abs(goals[2] - c) - 30;
		}
		ans[0] = dfs(index+1, a, b, c);
		ans[1] = dfs(index+1, a+lens[index], b, c)+10;
		ans[2] = dfs(index+1, a, b+lens[index], c)+10;
		ans[3] = dfs(index+1, a, b, c+lens[index])+10;

		return Calc.min(ans);
	}

}

class Calc {
	static int min(int[] nums) {
		int ans = nums[0];
		int len = nums.length;
		for(int i = 1; i < len; i++) {
			ans = Math.min(ans, nums[i]);
		}
		return ans;
	}
}


Measured memory_bytes: 24660
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> P3;
typedef pair<P ,P> PP;
constexpr ll MOD = ll(1e9) + 7;
constexpr int IINF = INT_MAX;
constexpr ll LLINF = LLONG_MAX;
constexpr int MAX_N = int(2e5) + 5;
constexpr double EPS = 1e-8;
constexpr int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define ALL(v) (v).begin(), (v).end()


int main() {
    string s;
    cin >> s;
    if(s == "Sunny"){
        cout << "Cloudy" << endl;
    }
    else if(s == "Cloudy"){
        cout << "Rainy" << endl;
    }
    else {
        cout << "Sunny" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long int llint;
llint x[55][55],cnt[55][55][65],dp[55][65],mod=1e9+7,n,k;
vector <int> v;
llint sum(llint a,llint b) {
	return (a+b)%mod;
}
llint mul(llint a,llint b) {
	return (a*b)%mod;
}
llint rek(int x,int ind) {
	/*cout << x << " " << ind << "\n";
	system("pause");*/
	if(ind==v.size()) return 1;
	if(dp[x][ind]!=-1) return dp[x][ind];
	llint ret=0;
	for(int i=0;i<n;i++) {
		ret=sum(ret,mul(cnt[x][i][v[ind]],rek(i,ind+1)));
	}
	dp[x][ind]=ret;
	return ret;
}
int main()
{
	/*ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);*/
	llint sol=0;
	cin >> n >> k;
	for(int i=0;i<n;i++) {
		for(int j=0;j<n;j++) {
			cin >> x[i][j];
			cnt[i][j][0]=x[i][j];
		}
	}
	//cout << "abc\n";
	//system("pause");
	for(llint i=1;i<62 && (1 << i)<=k;i++) {
		for(int j=0;j<n;j++) {
			for(int l=0;l<n;l++) {
				for(int m=0;m<n;m++) {
					cnt[j][l][i]=sum(cnt[j][l][i],mul(cnt[j][m][i-1],cnt[m][l][i-1]));
				}
				//if((1 << i)==k) sol=sum(sol,cnt[j][l][i]);
			}
		}
	}
	llint x=1,ind=0;
	while(x<=k) {
		if(k & x) v.push_back(ind);
		if(x>k/2) break;
		x*=2;
		ind+=1;
		//if(k & (1 << i)) cout << (1 << i) << "\n";
	}
	memset(dp,-1,sizeof(dp));
	for(int i=0;i<n;i++) {
		sol=sum(sol,rek(i,0));
	}
	cout << sol;
	return 0;
}


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

int main()
{
    int i, j ,k, n;
    int b, f, r, v;
    int room[4][3][10]; //Local variable 
   
    //Initialize all the element in the array to be 0
    for(i=0; i<4; i++)
        for(j=0; j<3; j++)
            for(k=0; k<10; k++)
                room[i][j][k] = 0;

    cin >> n;
    for(i=0; i<n; i++)
    {
        cin >> b >> f >> r >> v;
        room[b-1][f-1][r-1] += v;
    }
   
    for(i=0; i<4; i++)
    {
        for(j=0; j<3; j++)
        {
            for(k=0; k<10; k++)
            {
                cout << " " << room[i][j][k];
            }
            cout << endl;
        }
        if(i<3)
            cout << "####################" << endl;
    }
}


Measured memory_bytes: 3080
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long k = sc.nextLong();
        sc.close();
        long min = n % k;
        long res = (min > Math.abs(min-k)) ? Math.abs(min-k) : min;
        
        System.out.println(res);
    }
}

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

main() {
  int H, W; cin >> H >> W;
  for (int i = 0; i < H + 2; i++) {
    if (i == 0 || i == H + 1) {
      for (int i = 0; i < W + 2; i++) cout << '#';
      cout << endl;
    } else {
      string a; cin >> a;
      cout << '#' << a << '#' << endl;
    }
  }
}

Measured memory_bytes: 256
def pfact(n):
    d = {}
    while n % 2 == 0:
        d[2] = 1 if 2 not in d else d[2] + 1
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            d[f] = 1 if f not in d else d[f] + 1
            n //= f
        else:
            f += 2
    if n != 1:
        d[n] = 1 if n not in d else d[n] + 1
    return d

a, b = map(int, input().split())
A = pfact(a)
B = pfact(b)
d = {}
ans = 1
for k in A.keys():
    if k in B:
        ans += 1
print(ans)


Measured memory_bytes: 3064
#define _CRT_SECURE_NO_WARNINGS
#pragma warning(disable: 4244) // 最悪をします
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <queue>
#include <stack>
#include <map> 
#include <set>
#include <string>
#include <functional>
#include <list>
#include <random>
#include <time.h>
#include <iomanip>
#include <assert.h>
#include <numeric>
#include <sstream>
#define BIT(nr) (1UL << (nr))
#define int long long
//#define ll long long
#define double long double
#define mod 1000000007
#define MAXN (int)1e+5 * 2+1
#define LL_MAX 9223372036854775807	//ない環境用
#define LL_HALFMAX 9223372036854775807 / 2	//ない環境用
#define MIN -(9223372036854775807 / 2)
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define mp make_pair
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; }


using namespace std;

//デバッグ用カッコの有無
#ifdef DEBUG
template <class T>ostream &operator<<(ostream &o, const vector<T>&v)
{
	o << "{"; for (int i = 0; i<(int)v.size(); i++)o << (i>0 ? ", " : "") << v[i]; o << "}"; return o;
}
#endif // DEBUG

template <class T>ostream &operator<<(ostream &o, const vector<T>&v)
{
	for (int i = 0; i<(int)v.size(); i++)o << (i>0 ? " " : "") << v[i]; return o;
}

int dx[4] = { 0, 1, 0, -1 }; // x軸方向への変位
int dy[4] = { 1, 0, -1, 0 }; // y軸方向への変位

int dxp[4] = { 0, 1 }; // x軸方向への変位(正のみ)
int dyp[4] = { 1, 0 }; // y軸方向への変位(負のみ)

using Weight = int;
using Flow = int;
struct Edge {
	int src, dst;

	// libalgo のものに追加、メンバを追加するだけなので互換性は崩さないはず、逆辺のG[e.dstの]インデックスを保持
	int rev;
	Weight weight;
	Flow cap;
	Edge() : src(0), dst(0), weight(0) {}
	Edge(int s, int d, Weight w) : src(s), dst(d), weight(w) {}
};
using Edges = std::vector<Edge>;
using Graph = std::vector<Edges>;
using Array = std::vector<Weight>;
using Matrix = std::vector<Array>;

void add_edge(Graph& g, int a, int b, Weight w = 1) {
	g[a].emplace_back(a, b, w);
	g[b].emplace_back(b, a, w);
}
void add_arc(Graph& g, int a, int b, Weight w = 1) { g[a].emplace_back(a, b, w); }

void solve() {

}

int dp[30][50010];

signed main() {
	int n, m;
	cin >> n >> m;
	vector<int> c(m+1, -1);

	REPS(i, m) {
		cin >> c[i];
	}

	rep(i, 30) {
		rep(j, 50010) {
			dp[i][j] = LL_HALFMAX;
		}
	}

	dp[0][0] = 0;

	REPS(i, m) {
		rep(j, n + 1) {
			// 入れない
			chmin(dp[i][j], dp[i - 1][j]);
			// 入れる
			if (j - c[i] >= 0) {
				chmin(dp[i][j], dp[i][j - c[i]] + 1);
			}
		}
	}

	cout << dp[m][n] << "\n";
}



Measured memory_bytes: 14820
/* ex 9_2
   tomatokan */

#include<stdio.h>
#include<stdlib.h>

typedef struct node{
    int color;
    struct node *next;
}node;

void push(node **first,int elem){
    node *new=calloc(1,sizeof(node));
    if(new==NULL){
        printf("calloc failed\n");
        exit(1);
    }
    new->color=elem;
    new->next=*first;
    *first=new;
}

int pop(node **first){
    int elem;
    node *temp=*first;
    if(temp==NULL){
        printf("stack underflow");
        exit(1);
    }
    elem=temp->color;
    *first=temp->next;
    free(temp);
    return elem;
}

int get_tail(node **first){//最後の要素を得る
    return (*first)->color;
}

void add_cube(node **first,int *count,int color){
    //キューブの追加(異なる色が繋がると自動で消える)
    if(*first==NULL){
        push(first,color);
        return;
    }
    int tail_color=get_tail(first);
    if(tail_color!=color){
        *count+=2;
        pop(first);
    }else{
        push(first,color);
    }
}

int main(void){
    char input[100002];
    char *ptr;
    node *first=NULL;
    int count;
    ptr=input;
    fgets(input,100002,stdin);//入力の読み取り
    while(*ptr!='\0'&&*ptr!='\n'){
        if(*ptr=='0'){
            add_cube(&first,&count,0);
        }else{
            add_cube(&first,&count,1);
        }
        ptr++;
    }
    printf("%d\n",count);//出力
    return 0;
}

Measured memory_bytes: 4772
#include <iostream>
#include <array>
#include <vector>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
using namespace std;

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

const LL  INF=1<<31;
const LL MOD=1000000007;



int main(){
    int n;
    cin>>n;
    cout<<n*800-n/15*200<<endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define upperlimit 1000100
#define INF 1000000100
#define INFL 1000000000000000100
#define eps 1e-8
#define endl '\n'
#define sd(n) scanf("%d",&n)
#define slld(n) scanf("%lld",&n)
#define pd(n) printf("%d",n)
#define plld(n) printf("%lld",n)
#define pds(n) printf("%d ",n)
#define pllds(n) printf("%lld ",n)
#define pdn(n) printf("%d\n",n)
#define plldn(n) printf("%lld\n",n)
#define REP(i,a,b) for(i=a;i<=b;i++)
#define mp make_pair
#define pb push_back
#define pcc pair<char,char>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
#define tr(container,it) for(typeof(container.begin()) it=container.begin();it!=container.end();it++)
#define F first
#define S second
#define clr(a) memset(a,0,sizeof(a))
using namespace std;
 
ll gcd(ll n1,ll n2){
    if(!n1)return n2;
    if(!n2)return n1;
    if(n1%n2==0)return n2;
    return gcd(n2,n1%n2);
}
ll powmod(ll base,ll exponent){
    base%=mod;
    ll ans=1;
    while(exponent){
        if(exponent&1)ans=(ans*base)%mod;
        base=(base*base)%mod;
        exponent/=2;
    }
    ans%=mod;
    return ans;
}
int main()
{
    
    int N;
    cin>>N;
    int a[N],b[N];
    int r;
    for(int i=0;i<N;i++){
          cin>>a[i];
          cin>>b[i];
    }
   int maxa=0 ;
   int minb=b[0] ;
  
   for(int i = 0; i < N; i++){
    if(a[i] > maxa) maxa = a[i];
  }
    
    for(int i = 0; i < N; i++){
    if(b[i] < minb) minb = b[i];
  }
   r=maxa+minb;
    cout<<r; 
    return 0;
}

Measured memory_bytes: 1024