akhauriyash/Code-Regression huggingface dataset:
#if 0

#endif

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

int P[10010];
void init(int N) {
  for (int i=0; i<=N; ++i)
    P[i] = i;
}
int root(int a) {
  if (P[a] == a)
    return a;
  return (P[a] = root(P[a]));
}
bool is_same_set(int a, int b) {
  return root(a) == root(b);
}
void unite(int a, int b) {
  P[root(a)] = root(b);
}

int n, q;

int main() {
  cin >> n >> q;
  init(n-1);
  int c, x, y;
  for (int i = 0; i < q; i++) {
    cin >> c >> x >> y;
    if (c) {
      cout << int(is_same_set(x, y)) << endl;
    } else {
      unite(x, y);
    }
  }
}



Measured memory_bytes: 3172
#include <algorithm>
#include <vector>
#include <cfloat>
#include <string>
#include <cmath>
#include <set>
#include <cstdlib>
#include <map>
#include <ctime>
#include <iomanip>
#include <functional>
#include <deque>
#include <iostream>
#include <cstring>
#include <queue>
#include <cstdio>
#include <stack>
#include <climits>
#include <sys/time.h>
#include <cctype>

using namespace std;

typedef long long ll;


#define EPS (1e-10)
#define equals(a, b) (fabs((a)-(b)) < EPS)

#define EPS (1e-10)
#define equals(a, b) (fabs((a)-(b)) < EPS)

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(a*x, a*y); }
  Point operator / (double a) { return Point(x/a, y/a); }

  double norm() { return x*x+y*y; }
  double abs() { return sqrt(norm()); }

  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;
typedef vector <Vector> Polygon;

class Segment {
 public:
  Point p1, p2;

  Segment(Point p1 = Point(), Point p2 = Point()): p1(p1), p2(p2) {}
};

double norm(Vector a) {
  return a.x*a.x+a.y*a.y;
}

double abs(Vector a) {
  return sqrt(norm(a));
}

double getDistance(Point a, Point b) {
  return abs(a-b);
}

// ?????????|a||b|cos
double cross(Vector a, Vector b) {
  return a.x*b.y-a.y*b.x;
}
// ?????????|a||b|sin
double dot(Vector a, Vector b) {
  return a.x*b.x+a.y*b.y;
}

bool compareX(Point a, Point b) {
  return a.x < b.x;
}
bool compareY(Point a, Point b) {
  return a.y < b.y;
}
double bruteForce(Polygon p) {
  double ret = DBL_MAX;
  int n = p.size();
  for (int i = 0; i < n; i++) {
    for (int j = i+1; j < n; j++) {
      if (abs(p[i]-p[j]) < ret) ret = abs(p[i]-p[j]);
    }
  }
  
  return ret;
}

double stripClosest(Polygon s, double d) {
  double ret = d;
  sort(s.begin(), s.end(), compareY);

  int n = s.size();
  // ?????????????????????6??????????????????????????????
  for (int i = 0; i < n; i++) {
    for (int j = i+1; j < n && (s[j].y-s[i].y) < ret; j++) {
      if (abs(s[i]-s[j]) < ret) ret = abs(s[i]-s[j]);
    }
  }

  return ret;
}

double closestUtil(Polygon p) {
  int n = p.size();
  if (n <= 3) return bruteForce(p);

  int mid = n/2;
  Point midPoint = p[mid];

  Polygon p1, p2;
  for (int i = 0; i < mid; i++) p1.push_back(p[i]);
  for (int i = mid; i < n; i++) p2.push_back(p[i]);
  double dl = closestUtil(p1);
  double dr = closestUtil(p2);

  double d = min(dl, dr);

  Polygon s;
  for (int i = 0; i < n; i++) {
    if (abs(p[i].x-midPoint.x) < d) {
      s.push_back(p[i]);
    }
  }

  return min(d, stripClosest(s, d));
}

double closest(Polygon p) {
  sort(p.begin(), p.end(), compareX);

  return closestUtil(p);
}

int main() {
  int n;
  cin >> n;
  Polygon poly;
  for (int i = 0; i < n; i++) {
    double x, y;
    cin >> x >> y;
    poly.push_back(Vector(x, y));
  }
  cout << fixed << setprecision(20) << closest(poly) << endl;
}

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

int main(){
  int N;
  cin>>N;
  vector<int> A(N);
  int max1=0;
  int ind;
  for(int i=0;i<N;++i){
    cin>>A.at(i);
    if(A.at(i)>max1){
      max1=A.at(i);
      ind=i;
    }
  }

  int max2=0;
  for(int i=0;i<N;++i){
    if(A.at(i)!=max1 && A.at(i)>max2){
      max2=A.at(i);
    }
  }

  int count;
  for(int i=0;i<N;++i){
    if(A.at(i)==max1){
      ++count;
    }
  }

  if(count>1){
    for(int i=0;i<N;++i){
      cout<<max1<<endl;
    }
  }
  else{
    for(int i=0;i<N;++i){
      if(i==ind){
        cout<<max2<<endl;
      }
      else{
        cout<<max1<<endl;
      }
    }
  }
}

Measured memory_bytes: 2432
#include<bits/stdc++.h>
#define int long long
#define ld long double
#define ri register int
#define il inline
#define mk make_pair
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define all(x) x.begin(),x.end() 
#define rep(i,a,b) for(ri i=(a);i<=(b);++i)
#define per(i,a,b) for(ri i=(a);i>=(b);--i)
#define ls (x<<1)
#define rs (x<<1|1)
#define mid (l+r>>1)
#define de(x) cout << #x << " = " << x << endl
#define dd() cout << "Out Put!\n"
const int mod= 1e9+7,maxn=1000010;
const double eps = 1e-8,PI = acos(-1.0);
const int inf=0x7f7f7f7f;
using namespace std;
int a[maxn],b[maxn],v[maxn];
string s;
signed main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin >> n;
	int ans = 0;
	rep(i,1,n)
	{
	
		cin >> a[i];
		if(a[i] %2==1&&i%2==1)
			ans++;
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector<vector<int>> A(2, vector<int>(N));
    for (int i = 0; i < 2; i++) {
        for (int j = 0; j < N; j++) {
            cin >> A[i][j];
        }
    }

    int ans = 0;
    for (int i = 0; i < N; i++) {
        int temp = 0;
        temp += accumulate(A[0].begin(), A[0].begin() + i + 1, 0);
        temp += accumulate(A[1].begin() + i, A[1].end(), 0);
        ans = max(ans, temp);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#define rep(i,s,n)for(int i = s;i<n;i++)
#define repe(i,s,n)for(int i = s;i<=n;i++)
using namespace std;
static const int MAX_V = 100000;

//Graph Element
struct E {
	E(int t, int f) {
		to = t;
		from = f;
	}
	E(int t, int f, int c) {
		to = t;
		from = f;
		cost = c;
	}
	int to;
	int from;
	int cost;
	bool visited;
	bool use;
};
struct V {
	vector<E*> edge;
	bool visited;
};
V G[MAX_V];
/////////////////////////////////////////////

//dfs
int ans = 0;
int VS, ES;
void dfs(int n) {
	rep(i, 0, G[n].edge.size()) {
		if (G[n].edge[i]->use && !G[G[n].edge[i]->to].visited) {
			G[G[n].edge[i]->to].visited = true;
			dfs(G[n].edge[i]->to);
		}
	}
}

void dfs_stack_lib(int n) {
	rep(i, 0, G[n].edge.size()) {
		if (G[n].edge[i]->use && !G[G[n].edge[i]->to].visited) {
			G[G[n].edge[i]->to].visited = true;
			dfs(G[n].edge[i]->to);
		}
	}
}

void dfs_stack_array(int n) {
	int stack[1000] = {};
	int  e = 0;
	stack[e++] = n;
	int c = 0;

	while (e) {
		c = stack[--e];
		G[c].visited = true;

		rep(i, 0, G[c].edge.size()) {
			if (G[c].edge[i]->use && !G[G[c].edge[i]->to].visited) {
				stack[e++] = G[c].edge[i]->to;
			}
		}
	}
}
//BFS by array
void bfs_queue_array(int n) {
	int q[1000] = {};
	int s = 0, e = 0;
	q[e++] = n;
	int c = 0;

	while (s < e) {
		c = q[s++];
		G[c].visited = true;

		rep(i, 0, G[c].edge.size()) {
			if (G[c].edge[i]->use && !G[G[c].edge[i]->to].visited) {
				q[e++] = G[c].edge[i]->to;
			}
		}
	}
}

//BFS by queue ok
void bfs_queue_lib(int n) {
	queue<int> q;
	q.push(n);

	while (!q.empty()) {
		int c = q.front(); q.pop();
		G[c].visited = true;

		rep(i, 0, G[c].edge.size()) {
			if (G[c].edge[i]->use && !G[G[c].edge[i]->to].visited) {
				q.push(G[c].edge[i]->to);
			}
		}
	}
}

int main() {
	cin >> VS >> ES;

	rep(i, 0, ES)
	{
		int s, t; cin >> s >> t;
		G[s].edge.push_back(new E(t, s));
		G[t].edge.push_back(new E(s, t));
	}

	///////////////////////////////////////////////////////////
	//DFS
	//Edge all false
	repe(i, 1, VS) rep(j, 0, G[i].edge.size()) {
		//Edge all visited false;
		repe(k, 1, VS) rep(l, 0, G[k].edge.size()) G[k].edge[l]->use = true;
		repe(k, 1, VS) G[k].visited = false;

		G[i].edge[j]->use = false;

		//DFS
		G[1].visited = true;
		//dfs(1);
		dfs_stack_array(1);
		//dfs_stack_array(1);
		//bfs_queue_lib(1);

		bool ok = true;
		repe(k, 1, VS)  ok &= G[k].visited;
		if (!ok)ans++;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
int a,b,x[1001],n,sum,flag;
int main(){
	cin>>a>>b>>n;
	x[a]++;
	x[b]--;
	for(int i=0;i<n;i++){
		cin>>a>>b;
		x[a]+=2;
		x[b]-=2;
	}
	for(int i=0;i<1001;i++){
		sum+=x[i];
		if(sum>1&&sum%2)flag++;
	}
	cout<<(flag?1:0)<<endl;
}

Measured memory_bytes: 3092
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const double PI=3.141592653589;
const int INF=1000000007;
const ll LMAX=1000000000000001;
int gcd(int a,int b){if(a<b)swap(a,b);int c=a%b;while(c!=0){a=b;b=c;c=a%b;}return b;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};

int main(){
  double r; cin >>r;
  cout << 2*r*PI << endl;

  return 0;
}


Measured memory_bytes: 3780
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String S = in.next();
		int count = 0;

		for (int i = 0; i < S.length(); i++) {
			if (S.charAt(i) == 'o') {
				count++;
			}
		}
		int ans = 700 + count * 100;
		System.out.println(ans);
	}

}


Measured memory_bytes: 21460
package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)
	w := []string{"Sunny", "Cloudy", "Rainy"}
	n := 0
	for i, v := range w {
		if v == s {
			n = i
		}
	}
	if n == 2 {
		fmt.Println(w[0])
	} else {
		fmt.Println(w[n+1])
	}
}


Measured memory_bytes: 1752
/*
 
 
  author:@Prashant Singh
  created on :04/09/2019
 
 
 
*/
#include <bits/stdc++.h>
using namespace std;
 
typedef long long int ll;
 
#define mod 1000000007
#define pb push_back
#define endl cout<<"\n";
#define prt1(a) cout<<a<<" ";
#define prt2(a,b) cout<<a<<" "<<b<<" ";
#define prt3(a,b,c) cout<<a<<" "<<b<<" "<<c<<" ";
#define rep(i,st,end) for(int i=st;i<(int)end;i++)
#define repv(i,st,end) for(int i=st;i>=end;i--)
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
 
int main()
 {
  fio;
     ll tc,n,k,t,j,l,i,d,e,r;
      tc=1;
     // cin>>tc;
      while(tc--)
      {
       cin>>n;
       ll m=n-1;
      ll b[m];
      rep(i,0,m)
      cin>>b[i];

 /*     for(i=0;i<m;i++)
        cout<<b[i]<<" ";
      endl;
*/
ll sum=0;
ll a[n];
a[0]=b[0];
 for ( i = 1; i < (n-1); i++) {
            a[i] = min(b[i-1],b[i]);
        }
        a[n-1]=b[n-2];
/*for(i=0;i<n;i++)
  cout<<a[i]<<" ";
endl
*/
      for(i=0;i<n;i++)
        sum=sum+a[i];
      prt1(sum);
 
    }
  return 0;
}
  


Measured memory_bytes: 256
C = [0]*3
flg = True
for i in range(3):
  C[i] = list(map(int, input().split()))
for i in range(2):
  for j in range(2):
    if(C[i][j] -C[i][j+1] != C[i+1][j] -C[i+1][j+1]):
      flg = False
for i in range(2):
  for j in range(2):
    if(C[i][j] -C[i+1][j] != C[i][j+1] -C[i+1][j+1]):
      flg = False
print("Yes" if flg else "No")

Measured memory_bytes: 3064
#!/usr/bin/env python3
# n,m = map(int,sys.stdin.readline().split())
# a = list(map(int,sys.stdin.readline().split()))
# a = [sys.stdin.readline() for _ in range(n)]
# s = sys.stdin.readline().rstrip()
# n = int(sys.stdin.readline())
import sys,bisect
sys.setrecursionlimit(15000)

A,B,C,D = map(int,sys.stdin.readline().split())

if (C+B-1)//B <= (A+D-1)//D:
    print("Yes")
    exit()
print("No")


Measured memory_bytes: 9168
n,m = map(int,input().split())
x = list(map(int,input().split()))
x.sort()
a = []
ans = 0
for i in range(m-1):
  a.append(x[i+1]-x[i])
a.sort()
if n >= m:
  print(0)
else:
  for i in range(m-n):
    ans += a[i]
  print(ans)


Measured memory_bytes: 13960
#include<iostream>
#include<string>
#include<typeinfo>
#include<vector>
#include<algorithm>
#include<map>
#include<iomanip>
typedef long long int ll;
using namespace std;
int main()
{
	int w,a,b;
	cin >> w >> a >> b;
	
	if(abs(a-b)<=w){
		cout << "0" << endl;
	}else{
		cout << abs(a-b)-w << endl;
	}
	return 0;
}

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

#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")

#define endl        '\n'
#define ll          long long
#define pb          push_back
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define rs(v,n)     v.resize(n)
#define hell        1000000007
#define peak        9123372036854775807
#define pii         acos(-1)
#define clr(a,x)    memset(a,x,sizeof(a))
using namespace std;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

namespace InOp{
template<class x,class y>
istream &operator>>(istream &in,pair<x,y> &p) 
{ 
    in>>p.F>>p.S;
    return in;
}
template<class x>
istream &operator>>(istream &in,vector<x> &v) 
{
    for(auto& i:v)
        in>>i;
    return in;
}
template<class x,class y>
ostream &operator<<(ostream &out,pair<x,y> &p) 
{ 
    out<<"("<<p.F<<","<<p.S<<") ";
    return out; 
}
template<class x>
ostream &operator<<(ostream &out,vector<x> &v) 
{ 
    out<<v.size()<<endl;
    for(auto i:v)
        out<<i<<" ";
    out<<endl;
    return out; 
}
}
using namespace InOp;

namespace ModOp{
template<class x,class y,class z> z add(x a,y b,z m){return (a+b)%m;}
template<class x,class y,class z> z sub(x a,y b,z m){return (a-b+m)%m;}
template<class x,class y,class z> z mul(x a,y b,z m){return ((ll)a*b)%m;}
template<class y,class z> z expo(ll b,y e,z m){ll a=1;b%=m;while(e!=0){if((e&1)==1){a=a*b;a=a%m;}b=b*b;b%=m;e>>=1;}return a%m;}
template<class x,class z> z inv(x b,z m){return expo(b,m-2,m);}
template<class x,class y> x invGeneral(x a,y b){if(a==0)return b==1?0:-1;x m=invGeneral(b%a,a);return m==-1?-1:((1-(ll)b*m)/a+b)%b;}
template<class x,class y,class z> z div(x a,y b,z m){ll c=inv(b,m);return mul(a,c,m);}
}
using namespace ModOp;

namespace Debug{
template<class x> void deb(x a){cerr<<"a"<<": "<<a<<endl;}
template<class x,class y> void deb(x a,y b){cerr<<"a"<<": "<<a<<" | "<<"b"<<": "<<b<<endl;}
template<class x,class y,class z> void deb(x a,y b,z c){cerr<<"a"<<": "<<a<<" | "<<"b"<<": "<<b<<" | "<<"c"<<": "<<c<<endl;}
template<class x,class y,class z,class xy> void deb(x a,y b,z c,xy d){cerr<<"a"<<": "<<a<<" | "<<"b"<<": "<<b<<" | "<<"c"<<": "<<c<<" | "<<"d"<<": "<<d<<endl;}
}
using namespace Debug;

#define N  1000005

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    ll tt=1;
    // cin>>tt;
    while(tt--)
    {
        ll i,j,k,l,r,x,y,m,n;
        cin>>n;
        vi v(n);
        cin>>v;
        ll sum=0,ans=0;
        for(i=0;i<n;i++)
        {
            ans=(sum*v[i]+ans)%hell;
            sum=(sum+v[i])%hell;
        }
        cout<<ans;
    }
    return 0;
}

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

template <int MOD_> struct modnum {
	static constexpr int MOD = MOD_;
	static_assert(MOD_ > 0, "MOD must be positive");
 
private:
	using ll = long long;
 
	int v;
 
	static int minv(int a, int m) {
		a %= m;
		assert(a);
		return a == 1 ? 1 : int(m - ll(minv(m, a)) * ll(m) / a);
	}
 
public:
 
	modnum() : v(0) {}
	modnum(ll v_) : v(int(v_ % MOD)) { if (v < 0) v += MOD; }
	explicit operator int() const { return v; }
	friend std::ostream& operator << (std::ostream& out, const modnum& n) { return out << int(n); }
	friend std::istream& operator >> (std::istream& in, modnum& n) { ll v_; in >> v_; n = modnum(v_); return in; }
 
	friend bool operator == (const modnum& a, const modnum& b) { return a.v == b.v; }
	friend bool operator != (const modnum& a, const modnum& b) { return a.v != b.v; }
 
	modnum inv() const {
		modnum res;
		res.v = minv(v, MOD);
		return res;
	}
	modnum neg() const {
		modnum res;
		res.v = v ? MOD-v : 0;
		return res;
	}
 
	modnum operator- () const {
		return neg();
	}
	modnum operator+ () const {
		return modnum(*this);
	}
 
	modnum& operator ++ () {
		v ++;
		if (v == MOD) v = 0;
		return *this;
	}
	modnum& operator -- () {
		if (v == 0) v = MOD;
		v --;
		return *this;
	}
	modnum& operator += (const modnum& o) {
		v += o.v;
		if (v >= MOD) v -= MOD;
		return *this;
	}
	modnum& operator -= (const modnum& o) {
		v -= o.v;
		if (v < 0) v += MOD;
		return *this;
	}
	modnum& operator *= (const modnum& o) {
		v = int(ll(v) * ll(o.v) % MOD);
		return *this;
	}
	modnum& operator /= (const modnum& o) {
		return *this *= o.inv();
	}
 
	friend modnum operator ++ (modnum& a, int) { modnum r = a; ++a; return r; }
	friend modnum operator -- (modnum& a, int) { modnum r = a; --a; return r; }
	friend modnum operator + (const modnum& a, const modnum& b) { return modnum(a) += b; }
	friend modnum operator - (const modnum& a, const modnum& b) { return modnum(a) -= b; }
	friend modnum operator * (const modnum& a, const modnum& b) { return modnum(a) *= b; }
	friend modnum operator / (const modnum& a, const modnum& b) { return modnum(a) /= b; }
};
using num = modnum<int(1e9) + 7>;

const int MAXN = 2e5;
num fact[MAXN];

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

	fact[0] = 1;
	for (int i = 1; i < MAXN; i++) {
		fact[i] = fact[i-1] * i;
	}

	int N, M; cin >> N >> M;
	num ans = fact[N] * fact[M];
	if (N == M) {
		ans *= 2;
	} else if (abs(N - M) > 1) {
		ans = 0;
	}
	cout << ans << '\n';

	return 0;
}


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

#define int long long

using namespace std;

bool prime[2000100];

int32_t main()
{
    int n,p;
    cin >> n >> p;

    if(n == 1)
    {
        cout << p << endl;
        return 0;
    }

    int ans = 1;

    for(int i=2;i*i<=p;i++)
    {
        int cnt = 0;
        int t = p;

        while(t%i == 0)
            t /= i, cnt++;

        cnt /= n;

        if(cnt)
            ans = i;
    }

    cout << ans << endl;

    // if(n > 50)
    // {
    //     cout << 1 << endl;
    //     return 0;
    // }

    // prime[0] = prime[1] = true;

    // for(int i=2;i*i<=2000100;i++)
    // {
    //     if(!prime[i])
    //     {
    //         for(int j=i*i;j<2000100;j+=i)
    //             prime[j] = true;
    //     }
    // }

    // int ans =  1;

    // for(int i=2;i*i<=p;i++)
    // {
    //     if(!prime[i] && p%i == 0)
    //     {
    //         int cnt = 0;

    //         while(p%i == 0)
    //             p /= i, cnt++;

    //         cnt /= n;

    //         if(cnt > 0)
    //             ans = max(ans,ans*i*cnt);
    //     }
    // }

    // cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define uniq(x) (x).erase(unique(ALL(x)),(x).end())
#define SORT(x) sort(ALL(x))
#define REV(x) reverse(ALL(x))
#define foreach(it,x) for(__typeof((x).begin()) it=(x).begin();it!=(x).end();it++)
#define debug(x) cerr<<#x<<"="<<(x)<<endl
#define gett() cerr<<"Time:"<<clock()<<"ms."<<endl
#define ri(x) scanf("%d",&x)
#define rl(x) scanf("%lld",&x)
#define rlcfpoj(x) scanf("%I64d",&x)
#define pi(x) printf("%d",x)
#define pl(x) printf("%lld",x)
#define plcfpoj(x) printf("%I64d",x)
#define lfd() printf("\n")
#define sp() printf(" ")
int n;
long long a[200100];long long b[200100];long long c[200100];
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	for(int i=1;i<=n;i++)
		b[i]=a[i]*2;
	c[1]=0;
	for(int i=2;i<=n;i++){
		c[i]=b[i-1]-c[i-1];
	}
	c[1]+=(b[n]-(c[1]+c[n]))/2LL;
	for(int i=2;i<=n;i++){
		c[i]=b[i-1]-c[i-1];
	}
	for(int i=1;i<=n;i++)
		cout<<c[i]<<' ';
	return 0;
}


Measured memory_bytes: 4608
#include <bits/stdc++.h>
#define INF 5000000000000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main()
{
  ll N, a = INF;
  cin >> N;
  for (ll i = 0; i < 5; ++i) {
    ll b;
    cin >> b;
    a = min(a, b);
  }
  ll ans = 5 + (N + a - 1) / a - 1;
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <numeric>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep1(i,n) for (int i = 1; i <= n; ++i)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

long long combi(long long n, long long k) {
  std::map<std::string, long long> memo;
  if (n == k || k == 0)
    return 1;
  else {
    std::string key = std::to_string(n) + std::to_string(k);
    if (memo.count(key) != 0) {
      return memo[key];
    } else {
      ll out = combi(n - 1, k - 1) + combi(n - 1, k);
      memo[key] = out;
      return out;
    }
  }
}

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

  ll N,M; cin >> N >> M;

  ll ans = 0;
  if(N >= 2) {
    ans += combi(N, 2);
  }
  if(M >= 2) {
    ans += combi(M, 2);
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main{
	public static void main(String[] args) 	{
		Scanner sc = new Scanner(System.in);
		while(0 < 1){
			int sum = 0;
			String str = sc.next();
			if(str.length() == 1 && str.charAt(0) == '0') break;
			for(int i = 0;i < str.length();i++) {
				sum += str.charAt(i) - '0';
			}
			System.out.printf("%d\n",sum);
			}
		sc.close();
	}	
}


Measured memory_bytes: 26964
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>
#include <cassert>
#include <bitset>

using namespace std;

/* template */

using ll = long long;

void debug_out() { std::cout << std::endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cout << "debug: "; debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif

#define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define rrep(i, a, n) for (int i = ((int)(n-1)); i >= (int)(a); i--)
#define Rep(i, a, n) for (long long i = (long long)(a); i< (long long)(n); i++)
#define RRep(i, a, n) for (long long i = ((long long)(n-1ll)); i>=(long long)(a); i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}

struct Edge{
    int to;
    ll weight;
    Edge(int t, ll w) : to(t), weight(w){ }
};

struct edge{
    int from;
    int to;
    ll weight;
    edge(int f,int t,ll w) : from(f), to(t), weight(w){ }
};


using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

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>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

constexpr ll LNF = 1LL<<60;

constexpr int INF = 1e9+7;

const double PI=3.14159265358979323846;


vector<int> dx = {-1,0,1,0,-1,1,-1,1};
vector<int> dy = {0,-1,0,1,1,-1,-1,1};

/* template */

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,m,x; cin >> n >> m >> x;
    vector<int> c(n);
    vector<vector<int>> a(n,vector<int>(m));
    rep(i,0,n){
        cin >> c[i];
        rep(j,0,m){
            cin >> a[i][j];
        }
    }
    int ans = INF;
    rep(bit,0,1<<n){
        int s = 0;
        vector<int> p(m,0);
        rep(i,0,n){
            if(bit & (1<<i)){
                s += c[i];
                rep(j,0,m){
                    p[j] += a[i][j];
                }
            }
        }
        int flag = 0;
        rep(i,0,m){
            if(p[i]<x){
                flag = 1;
                break;
            }
        }
        if(flag) continue;
        chmin(ans,s);
    }
    if(ans==INF){
        cout << -1 << endl;
        return 0;
    }
    cout << ans << endl;
} 

Measured memory_bytes: 3628
def main():
  a, b, c = map(int, input().rstrip("\n").split(" "))

  import math

  container_size = (a * a * b)
  if c <= container_size / 2:
    height = a * (c / (container_size / 2))
    angle = math.degrees(math.atan(height / b))
  else:
    empty_space = container_size - c
    width = b * (empty_space / (container_size / 2) )
    #print(empty_space,width)
    angle = 90 - math.degrees(math.atan(width / a))

  print(90 - angle)

if __name__ == '__main__':
  main()
  

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll INF=(ll)1e9;
const ll MOD=(ll)1e9+7;
vector<int> dx={1,0,-1,0},dy={0,1,0,-1};

int main(){
  ll N,A,B,ans=0;
  cin>>N>>A>>B;
  ll x[N];
  for(ll i=0;i<N;i++) cin>>x[i];
  for(ll i=0;i<N-1;i++){
    if((x[i+1]-x[i])*A>B) ans+=B;
    else ans+=(x[i+1]-x[i])*A;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;


int n,m;
vector<int> a;
int ans,xx;

int main(){
  scanf ("%d %d",&n,&m);
  while(n){
    ans=0;
    a.assign(n,0);
    for(int t=0;t<n;++t){
      scanf ("%d",&a[t]);
    }
    sort(a.begin(),a.end());
    for(int p=0;p<n&&a[p]<m;++p){
      for(int q=p+1;q<n&&xx<=m;++q){
        xx=a[p]+a[q];
        if(ans<xx&&xx<=m){
          ans=xx;
        }
      }
      xx=0;
    }
    if(ans==0){
      printf("NONE\n");
    }
    else{
      printf("%d\n",ans);
    }
    scanf ("%d %d",&n,&m);
  }
}




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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i ++) {
    cin >> a.at(i);
    a.at(i) --;
  }

  int now = 0, cnt = 0;
  while (true) {
    if (now == 1) {
      cout << cnt << endl;
      return 0;
    }
    if (cnt >= n) {
      cout << -1 << endl;
      return 0;
    }
    cnt ++;
    now = a.at(now);
  }
}


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

using Int = long long;
const char newl = '\n';

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;}
template<typename T> void drop(const T &x){cout<<x<<endl;exit(0);}
template<typename T=int>
vector<T> read(size_t n){
  vector<T> ts(n);
  for(size_t i=0;i<n;i++) cin>>ts[i];
  return ts;
}


struct UnionFind{
  int num;
  vector<int> rs,ps;
  UnionFind(){}
  UnionFind(int n):num(n),rs(n,1),ps(n,0){iota(ps.begin(),ps.end(),0);}
  int find(int x){
    return (x==ps[x]?x:ps[x]=find(ps[x]));
  }
  bool same(int x,int y){
    return find(x)==find(y);
  }
  void unite(int x,int y){
    x=find(x);y=find(y);
    if(x==y) return;
    if(rs[x]<rs[y]) swap(x,y);
    rs[x]+=rs[y];
    ps[y]=x;
    num--;
  }
  int size(int x){
    return rs[find(x)];
  }
  int count() const{
    return num;
  }
};

//INSERT ABOVE HERE
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);

  int n,m;
  cin>>n>>m;
  UnionFind uf(n);
  for(int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;
    a--;b--;
    uf.unite(a,b);
  }
  int ans=0;
  for(int i=0;i<n;i++) chmax(ans,uf.size(i));
  cout<<ans<<newl;
  return 0;
}


Measured memory_bytes: 4764
#include <iostream>
using namespace std;
int main(){

  int h,w;
  int n;
  while(  cin >> w >> h,h+w){

    cin >> n;

    int G[20][20] = {{0}};
    for(int i = 0 ; i <= h ; i++ ){
      for(int j = 0 ; j <= w ; j++ ){
	if(i == 1 || j == 1)G[j][i] = 1;
      }
    }
    G[0][0] = G[0][1] = G[1][0] = 0;
    int x,y;
    for(int i = 0 ; i < n ; i++ ){
      cin >> x >> y;
      if(x == 1 || y == 1){
	if(x == 1 ){
	  for(int k = y ; k <= h ; k++ )G[1][k] = 0;
	}
	if(y == 1){
	  for(int k = x ; k <= w ; k++ )G[k][1] = 0;
	}
      }else  G[x][y] = -1;
    }
    /*    cout << "--------------" << endl;
    for(int i = h ; i >= 1 ; i-- ){
      for(int j = 1 ; j <= w ; j++ ){
	cout << G[j][i] << ' ';
      }
      cout << endl;
    }
    cout << "--------------" << endl;*/
    for(int i = 2 ; i <= h ; i++ ){
      for(int j = 2 ; j <= w ; j++ ){
	if(G[j][i] == -1)G[j][i] = 0;
	else G[j][i] = G[j-1][i]+G[j][i-1];
      }
    }
    /*  cout << "--------------" << endl;
    for(int i = h ; i >= 1 ; i-- ){
      for(int j = 1 ; j <= w ; j++ ){
	cout << G[j][i] << ' ';
      }
      cout << endl;
    }
    cout << "--------------" << endl;*/
    cout << G[w][h] << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n)  for (int i = 0; i < (int) (n); i++)
#define REP1(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x)     (x).begin(), (x).end()
#define SZ(x)      ((int) (x).size())
using ll = long long;

int main() {
  ll a, v, b, w, t;
  cin >> a >> v >> b >> w >> t;
  if (abs(a - b) <= t * (v - w)) {
	  cout << "YES" << endl;
	} else {
	  cout << "NO" << endl;
	}
  return 0;
}


Measured memory_bytes: 3560
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define REP(i,n) for(int i=0,_n=(n);(i)<(int)_n;++i)
#define RANGE(i,a,b) for(int i=(int)a,_b=(int)(b);(i)<_b;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define PRINT1(table, D0) REP(d0, D0) cout<<table[d0]<<" "; cout<<"\n";
#define PRINT2(table, D0, D1) REP(d0, D0) { REP(d1, D1) cout<<table[d0][d1]<<" "; cout<<"\n"; }
#define PRINT3(table, D0, D1, D2) REP(d0, D0) { REP(d1, D1) { REP(d2, D2) cout<<table[d0][d1][d2]<<" "; cout<<"\n"; } cout<<"\n"; }
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }

#define MOD 1000000007LL
#define INF (1LL<<60)

int main() {
	//ios::sync_with_stdio(false);
	ll A,B,C;
	string s;
	while(cin>>A>>B>>C) {
		ll cnt=0;
		while(1) {
			if(A%2||B%2||C%2) break;
			ll nA = B/2+C/2;
			ll nB = A/2+C/2;
			ll nC = A/2+B/2;
			if(A==nA&&B==nB&&C==nC) {cnt=-1;break;}
			A = nA, B = nB, C = nC;
			cnt++;
		}
		
		cout<<cnt<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 888
N = int(input())
List = list(map(int, input().split()))
a=1
if  0 in List:
    print(0)

else:
    for i in List:
        a=a*i
        if a>10**18:
            print('-1')
            break
if not a>10**18 and not 0 in List:
    print(a)

Measured memory_bytes: 21792
p,M=pow,1000003
f=[1]*M
for i in range(1,M):f[i]=f[i-1]*i%M
for _ in'_'*input():x,d,n=map(int,raw_input().split());t=x*p(d,M-2,M)%M;print[p(x,n,M),M/(t+n)and f[t+n-1]*p(f[t-1],M-2,M)*p(d,n,M)%M][d>0]

Measured memory_bytes: 44264
"""
区間スケジューリング
終端で降順にソートすれば良い
"""
n, m=map(int, input().split())
hope=[]
for i in range(m):
    a, b=map(int, input().split())
    hope.append((a, b))
hope.sort(reverse=True, key=lambda x: x[0])
hope.sort(reverse=True, key=lambda x: x[1])
ans=0
for i in range(m-1):
    if i==0:
        target=hope[i][0]
    if target<hope[i+1][1]:
        if target<hope[i+1][0]:
            target=hope[i+1][0]
    else:
        ans=ans+1
        target=hope[i+1][0]
print(ans+1)


Measured memory_bytes: 60376
#include <bits/stdc++.h>
#include <regex>
#ifdef _DEBUG
#include "debug.h"
#endif
#define int ll
#define FOR(i, s, e) for (int i = int(s); i < int(e); ++i)
#define REP(i, e) FOR(i, 0, e)
#define all(v) (v).begin(),(v).end()
#define mkpr make_pair
#define mktp make_tuple
#define tv(tp, i) get<(i)>(tp)
#define CLEAR(obj) obj = decltype(obj)()
#define var auto
#define OUT(type) type &
#define IN(type) const type &
#define self (*this)
#define in :
#define True true
#define False false
using namespace std; using int32 = int32_t; using str = string; using cstr = const str;
using ll = long long; using ull = unsigned long long; using cint = const int; using cll = const ll;
using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>;
using vb = vector<bool>; using vvb = vector<vb>; using vd = vector<double>; using vvd = vector<vd>;
using vc = vector<char>; using vvc = vector<vc>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>; using pdd = pair<double, double>; using psl = pair<string, ll>;
using tiii = tuple<int, int, int>; using tlll = tuple<ll, ll, ll>;
static const int MGN = 10; static const int ARYSZ_MAX = (int)1e7;
static const ll LINF = LLONG_MAX/2;
#ifdef int
static const int INF = LINF;
#else
static const int INF = INT_MAX/2;
#endif
static double EPS = 1e-9;
#define FASTCIN() cin.tie(0);ios::sync_with_stdio(false);
#ifdef IMPORT_SAMPLE
#define DEBUG_IMPORT(file) vs args(argv, argv+argc);str sample = make_sample(args, file);ifstream ifs(sample); cin.rdbuf(ifs.rdbuf());
#else
#define DEBUG_IMPORT(file)
#endif
static inline bool DBLEQ(double a, double b) {return abs(a - b) < EPS;}
static inline void EPR(str msg) {cerr << msg << endl;}
static inline void AST(bool exp, str msg) {if(!exp){EPR(msg);} assert(exp);}
static inline void TAST(bool exp, str msg) {if(!exp){EPR(msg);} while(!exp){}}


int32 main(int32 argc, char* argv[]) {
    FASTCIN();
    DEBUG_IMPORT("sample-1");


    int N; cin>>N;
    vi H(N); REP(i,N) cin>>H[i];

    var dp = vi(N+1, INF);
    // dp[i] := i に行くための最小のコスト
    dp[0] = 0;
    dp[1] = abs(H[1] - H[0]);
    FOR(i, 2, N) {
        dp[i] = min(dp[i-1]+abs(H[i] - H[i-1]), dp[i-2]+abs(H[i] - H[i-2]));
    }

    int ans = dp[N-1];
    cout << ans << endl;

    
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <cmath>
using namespace std;

int main(){
    string t, s;
    cin >> s >> t;
    int length = s.length();
    string tmp = s;
    for(int i = 0; i < length; i++){
        string tmp2 = tmp;
        tmp2[0] = tmp[length-1];
        for(int j = 1; j < length; j++){
            tmp2[j] = tmp[j-1];
        }
        if(tmp2 == t){
            cout << "Yes" << endl;
            return 0;
        }
        tmp = tmp2;
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=200000+10;
int numa[maxn];
int numb[maxn];
int main() {
	int n;
	while(~scanf("%d",&n)) {
		for(int i=1; i<=n; i++) {
			scanf("%d",&numa[i]);
			numb[i]=numa[i];
		}
		sort(numa+1,numa+n+1);
		int m=n/2;
		for(int i=1; i<=n; i++) {
			if(numb[i]<=numa[m])
				printf("%d\n",numa[m+1]);
			else
				printf("%d\n",numa[m]);
 
		}
	}
	return 0;
}

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

int main() {
  long long D, N;
  scanf("%lld %lld", &D, &N);
  long long ans;
  if (N < 100) {
    ans = N * pow(100, D);    
  } else {
    ans = 101 * pow(100, D);
  }
  cout << ans << '\n';
  
  return 0;
}


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

#define ff first
#define ss second
using namespace std;
#define maxn 2000006
#define pb push_back
#define ll long long
#define lll __int128
#define vll vector<ll>
#define mll map<ll,ll>
#define MOD 1000000007
#define pll pair<ll,ll>
#define ull unsigned long long
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fr(i,x,n) for(int i=x;i>=n;i--)
inline void fastio() {ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);}

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



int main() {
	fastio();

	ll  n, k; cin >> n >> k;
	vll h(n); f(i, 0, n - 1) cin >> h[i];

	vll dp(n, INT_MAX);

	dp[0] = 0ll;

	f(i, 1, n - 1) {
		fr(j, i - 1, max(0ll, i - k)) {
			dp[i] = min( dp[i], dp[j] + abs(h[i] - h[j]) );
		}
	}

	cout << dp[n - 1];

	return 0;
}

Measured memory_bytes: 1792
import java.util.*;

class Main {
    public static void main(String args[]) {
        Scanner inp = new Scanner(System.in);
        int a = inp.nextInt();
        int b = inp.nextInt();
        int c = inp.nextInt();
        int d = inp.nextInt();
        int ab = a * b;
        int cd = c * d;
        System.out.println(max(ab, cd));
    }
    public static int max(int x, int y) {
        if (x > y) return x;
        return y;
    }
}

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

int main() {
    vector <int> card(9);
    for(int i = 0; i < 9; i++){
        int tmp;
        cin >> tmp;
        card[i] = tmp;
    }

    int N;
    cin >> N;
    vector <int> check(9);
    for(int i = 0; i < 9; i++){
        check[i] = 0;
    }
    for(int i = 0; i < N; i++){
        int tmp;
        cin >> tmp;
        for(int j = 0; j < 9; j++){
            if(card[j] == tmp){
                check[j] = 1;
            }
        }
    }

    string ans = "No";
    if(check[0] + check[1] + check[2] == 3){
        ans = "Yes";
    }
    if(check[3] + check[4] + check[5] == 3){
        ans = "Yes";
    }
    if(check[6] + check[7] + check[8] == 3){
        ans = "Yes";
    }
    if(check[0] + check[3] + check[6] == 3){
        ans = "Yes";
    }
    if(check[1] + check[4] + check[7] == 3){
        ans = "Yes";
    }
    if(check[2] + check[5] + check[8] == 3){
        ans = "Yes";
    }
    if(check[0] + check[4] + check[8] == 3){
        ans = "Yes";
    }
    if(check[2] + check[4] + check[6] == 3){
        ans = "Yes";
    }
    cout << ans << endl;
}

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

signed main(){
  int n;
  cin >> n;
  unsigned long long sum = 0;
  for(int i = 1; i <= n; i++){
    if(i % 3 == 0)
      continue;
    if(i % 5 == 0)
      continue;
    if(i % 3 == 0 && i % 5 == 0)
      continue;
      

    sum += i;
    
  }
  cout << sum << endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define ld long double
#define MOD 1000000007
#define endl "\n"
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(var) (var).begin(), (var).end()
#define MAXX 9000000000000000000
#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vector<int> >
#define vpi vector<pair<int,int> > 
#define vvpi vector<vector<pair<int,int> > >

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif

	int n,i,j,x,y,m,a=0;
	cin >> n >> m >> x;
	y = 0;
	while(y <= m)
	{
		if(y >= n)
		{
			a++;
		}
		y+= x;
	}

	cout << a;
	return 0;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
#define LL long long
using namespace std;
const LL N=2009,MOD=1e9+7;
LL n,k;
LL fac[N*N],invfac[N*N],f[N][N];
template<typename T>
inline void read(T &x)
{
	x=0;T w=1;char c=getchar();
	while(!isdigit(c)){if(c=='-')w=-1;	c=getchar();}
	while(isdigit(c)){x=(x<<3)+(x<<1)+c-'0';	c=getchar();}
	x*=w;
}
LL qpow(LL a,LL b,LL p)
{
	LL x=a,ans=1;
	while(b)
	{
		if(b&1)	ans=ans*x%p;
		x=x*x%p;
		b>>=1;
	}
	return ans%p;
}
LL inv(LL a,LL p)
{
	return qpow(a,p-2,p);
}
LL C(LL n,LL m)
{
	return fac[n]*invfac[m]%MOD*invfac[n-m]%MOD;
}
void init(LL n)
{
	fac[0]=1;
	for(LL i=1;i<=n;++i)
		fac[i]=fac[i-1]*i%MOD;
	invfac[n]=inv(fac[n],MOD);
	for(LL i=n-1;i>=0;--i)
		invfac[i]=invfac[i+1]*(i+1)%MOD;
}
int main()
{
	read(n);read(k);
	if(k==1)
	{
		printf("1");
		return 0;
	}
	init(n*k);
	f[0][0]=1;
	for(LL i=0;i<=n;++i)
		for(LL j=max(i,1ll);j<=n;++j)
			f[i][j]=((i?f[i-1][j]:0)+f[i][j-1]*C(i+j*(k-1)-1,k-2))%MOD;
	printf("%lld",f[n][n]*fac[n]%MOD);
	return 0;
}

Measured memory_bytes: 94592
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define PF push_front
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double
#define pii pair<int,int>
#define pll pair<LL,LL>
#define vi vector<int>
#define vl vector<LL>
#define vii vector<vi>
#define vll vector<vl>

const double pi = 3.14159265358979323846264;
const int mod=1000000007;
LL ans=0,S;


//mod演算ライブラリ
//mod=1000000007

LL add(LL a,LL b){
  return (a+b)%mod;
}

LL sub(LL a,LL b){
  return (a+mod-b)%mod;
}

LL mul(LL a,LL b){
  return ((a % mod) * (b % mod)) % mod;
}

LL power(LL x,LL y){//繰り返し二乗法 単品利用可
  if(y==0)return 1;
  else if(y==1)return x%mod;
  else if(y%2==0){
    LL tmp=power(x, y/2) % mod;
    return tmp*tmp%mod;
  }else {
    LL tmp=power(x, y/2) % mod;
    return ((tmp*tmp)%mod)*x%mod;
  }
}

LL dvs(LL a,LL b){
  return mul(a,power(b,mod-2));
}

const int SIZE_mod=200005;
int invfact[SIZE_mod];
int fact[SIZE_mod];

void factset(int a){//aまでの階乗%mod表を作成
  fact[0]=1;
  FORQ(i,1,a){
    fact[i]=mul(fact[i-1],i);
  }
}

void cmbset(int a){//1~aまでの階乗と階乗数の逆元のmod(mod)を用意 O(a)
  factset(a);
  invfact[a]=power(fact[a],mod-2);
  invfact[0]=1;
  FORD(i,a,1){
    invfact[i]=mul(invfact[i+1],i+1);
  }

}

LL cmb(int n,int r){//nCr%mod  (cmbset後に使用)
  if(n<r||r<0||n<0)return 0;
  return mul(fact[n],mul(invfact[r],invfact[n-r]));
}

LL prm(int n,int r){//nPr%mod
    return mul(cmb(n,r),fact[n]);
}

LL homo(int n,int r){//nHr%mod
  return cmb(n+r-1,r);
}
vl dp;

LL rec(vi &a, int ln, int sum){
    int rst=S-sum;
    LL tmp=0;
    if(rst==0){
        dp[rst]=1;
        return 1;
    }
    FOR(i,3,rst+1){
        if(dp[rst-i]){
            tmp=add(tmp,dp[rst-i]);
        }else{
            a[ln]=i;
            ln++;
            tmp=add(tmp,rec(a,ln,sum+i));
            ln--;
        }
        
    }
    dp[rst]=tmp;
    if(ln==0)ans=add(ans,tmp);
    return tmp;
}

int main(){
	LL s;
    cin>>s;
    dp=vl(s+1,0);
    factset(10000);
    S=s;
    vi a(1000,0);
    rec(a,0,0);
    cout<<ans;
}


Measured memory_bytes: 3732
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
int main() {
   int a,b,c,d;
   cin>>a>>b>>c>>d;
   while(a>=0 || c>=0){
      c=c-b;
      if(c<=0){
        cout<<"Yes";
        return 0;
      }
      a=a-d;
      if(a<=0){
        cout<<"No";
        return 0;
      }
   }
}

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


bool hantei(vector<int> numbers){
  for (int i=0; i<numbers.size(); i++){
    if (numbers.at(i)%2==1){
      return false;
    } else {
      continue;
    }
  }
  return true;
}

vector<int> waru2(vector<int> &numbers){
  for (int i=0; i<numbers.size(); i++){
    numbers.at(i) /= 2;
  }
  return numbers;
}


int main(){
  int n;
  cin >> n;
  vector<int> seisuu(n);
  for (int i=0; i<n; i++){
    cin >> seisuu.at(i);
  }
  
  int counter = 0;
  while(hantei(seisuu)){
   	waru2(seisuu);  // 2でわる
    counter++;
  }
  cout << counter << endl;
  
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;

namespace ABC120
{
    class B
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split();
            int A = int.Parse(input[0]);
            int B = int.Parse(input[1]);
            int K = int.Parse(input[2]);

            int n = CalcGCD(A, B);
            List<int> l = new List<int>();

            for (int i = 1; i <= n; i++)
            {
                if (A % i == 0 && B % i == 0) { l.Add(i); }
            }

            Console.WriteLine(l[l.Count - K]);
        }

        static int CalcGCD(int A, int B)
        {
            if (B == 0) { return A; }

            return CalcGCD(B, A % B);
        }

    }
}


Measured memory_bytes: 13140
//#pragma GCC optimize(2)
// Happy TLE and WA every day!
// by: zxb the vegetable chicken
#include<bits/stdc++.h>
#define mp              make_pair
#define rep(i,n)        for(int i = 0; i < n; i++)
#define foreach(i,c)    for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define BINF            0x7fffffff
#define INF             0x3f3f3f3f
#define LINF            4557430888798830399
#define pb              push_back
#define F               first
#define S               second
#define Time            clock()/CLOCKS_PER_SEC
#define read            ZXBs_fast_input
#define write           ZXBs_fast_output
//#define usingFiles
using namespace std;

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

inline bool read(int& x){
	x = 0;
	int c;
	int sign = 1;
	while( (c = getchar()) < '0' || c > '9' ) if(c == '-') sign = -1;
	x = c ^ '0';
	while( (c = getchar()) >= '0' && c <= '9' ) x = (x<<3) + (x<<1) + (c ^ '0');
	x *= sign;
	return 1;
}

inline bool write(int x){
	if(x >= 10) write(x / 10);
	putchar(x % 10 + '0');
	return 1;
}

const int rp = 666666;
const bool debug = 1;
const bool I_good_vegetable_a = 1;

int n, m;
vector<int> graph[100100];
int inDeg[100100];
int pre[100100];

signed main(){
	ios::sync_with_stdio(false);
	#ifdef usingFiles
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	cin >> n >> m;
	rep(i, n + m - 1){
		int a, b;
		cin >> a >> b;
		a--, b--;
		graph[a].pb(b);
		inDeg[b]++;
	}
	queue<int> q;
	rep(i, n){
		if(inDeg[i] == 0){
			pre[i] = -1;
			q.push(i);
		}
	}
	while(!q.empty()){
		int now = q.front(); q.pop();
		rep(i, graph[now].size()){
			int to = graph[now][i];
			inDeg[to]--;
			if(inDeg[to] == 0){
				pre[to] = now;
				q.push(to);
			}
		}
	}
	rep(i, n) cout << pre[i] + 1 << endl;
	return 0;
}

Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	for(int i=0;i<s.length()-1;i++)
	if(s[i]==s[i+1]) { cout<<i+1<<" "<<i+2; return 0; }
	for(int i=0;i<s.length()-2;i++)
	if(s[i]==s[i+2]) { cout<<i+1<<" "<<i+3; return 0; }
	cout<<"-1 -1";
	return 0;
}

Measured memory_bytes: 512