akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

#define ll long long
#define pb push_back
#define sz(x) (int)(x).size()
#define mp make_pair
#define f first
#define s second
#define all(x) x.begin(), x.end()

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>; ///find_by_order(),order_of_key()
template<class T1, class T2> ostream& operator<<(ostream& os, const pair<T1,T2>& a) { os << '{' << a.f << ", " << a.s << '}'; return os; }
template<class T> ostream& operator<<(ostream& os, const vector<T>& a) {
	os << '{';
	for(int i=0;i<sz(a);i++)
	{
		if(i>0&&i<sz(a)-1)
			os << ", ";
		os << a[i];
	}
	os << '}';
    return os;
}
const int N=1e5+5;
vector<vector<int> > graf(N);
vector<int> sol(N,-1);
int dfs(int tr)
{
    if(sol[tr]!=-1)
        return sol[tr];
    sol[tr]=0;
    for(auto p:graf[tr])
    {
        sol[tr]=max(sol[tr],1+dfs(p));
    }
    return sol[tr];
}
int main()
{
    int n,m;
    scanf("%i %i",&n,&m);
    vector<int> indegree(n);
    for(int i=0;i<m;i++)
    {
        int a,b;
        scanf("%i %i",&a,&b);
        a--;
        b--;
        graf[a].pb(b);
        indegree[b]++;
    }
    int maxx=0;
    for(int i=0;i<n;i++)
    {
        maxx=max(maxx,dfs(i));
    }
    printf("%i\n",maxx);
    return 0;
}


Measured memory_bytes: 8576
#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <algorithm>
using namespace std;
string s;
map<string, int> v;
int main() {
    queue<pair<string, int> > q;
    q.push({"01234567", 0});
    v["01234567"]=0;
    while (!q.empty()) {
        string ss = q.front().first;
        int step = q.front().second;
        q.pop();
        int p = 0;
        while (p < 8 && ss[p] != '0') ++p;
        swap(ss[p], ss[p + (p < 4 ? 4 : -4)]);
        if (!v.count(ss)) {
            v[ss] = step + 1;
            q.push({ss, step + 1});
        }
        swap(ss[p], ss[p + (p < 4 ? 4 : -4)]);
        if (p % 4 != 3) {
            swap(ss[p], ss[p + 1]);
            if (!v.count(ss)) {
                v[ss] = step + 1;
                q.push({ss, step + 1});
            }
            swap(ss[p], ss[p + 1]);
        }
        if (p % 4 != 0) {
            swap(ss[p], ss[p - 1]);
            if (!v.count(ss)) {
                v[ss] = step + 1;
                q.push({ss, step + 1});
            }
            swap(ss[p], ss[p - 1]);
        }
    }
    while (getline(cin, s)) {
        s.erase(remove(s.begin(), s.end(), ' '), s.end());
        cout <<v[s]<<endl;
    }
    return 0;
}



Measured memory_bytes: 5344
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

#define MAX_V 1000000

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int H, W;
	cin >> H >> W;
	char maze[H][W];
	rep(i, 0, H) rep(j, 0, W) cin >> maze[i][j];

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

	rep(i, 0, H) rep(j, 0, W) {
		if(maze[i][j] == '.') continue;
		if(maze[i][j] == '#') {
			bool flag = false;
			rep(k, 0, 4) {
				int nx = j + dx[k];
				int ny = i + dy[k];
				if(0 <= nx && nx < W && 0 <= ny && ny < H) {
					if(maze[ny][nx] == '#') {
						flag = true;
					}
				}
			}
			if(!flag) {
				cout << "No" << endl;
				return 0;
			}
		}
	}

	cout << "Yes" << endl;


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define maxs 200202
#define mme(i,j) memset(i,j,sizeof(i))
using namespace std;
long long a[202];



long long lcm(long long x,long long y){
    return x/__gcd(x,y)*y;
}
int main()
{
    int n;
    while(~scanf("%d",&n))
    {

        scanf("%lld",&a[1]);
        long long lc=a[1];
        for(int i=2;i<=n;i++)
        {
            scanf("%lld",&a[i]);
            lc = lcm(lc,a[i]);
        }
        printf("%lld\n",lc);
    }
    return 0;
}

Measured memory_bytes: 256
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define LL long long
#define double long double
using namespace std;
const double pi=acos(-1);
struct poLL {LL  x,y,num;}p[110],a[110];
double ans[110];
LL multi(poLL  p1,poLL  p2,poLL  p0)
{
	LL x1=p1.x-p0.x,y1=p1.y-p0.y;
	LL x2=p2.x-p0.x,y2=p2.y-p0.y;
	return x1*y2-x2*y1;
}
LL  n,top=0,sta[110];
LL  dis(poLL  a,poLL  b) {return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);}
bool cmp(poLL a,poLL b)
{
	LL t1=multi(b,a,p[1]);
	return t1==0?dis(p[1],a)<dis(p[1],b):t1>0;
}
void solve()
{
	for(LL  i=2;i<=n;i++)
		if((p[1].x==p[i].x)?(p[i].y<p[1].y):(p[i].x<p[1].x)) swap(p[1],p[i]);
	sort(p+2,p+n+1,cmp);
	sta[++top]=1;
	for(LL  i=2;i<=n;i++)
	{
		while(top>1&&multi(p[sta[top]],p[sta[top-1]],p[i])<0) top--;
		sta[++top]=i;
	}
}
double get(poLL  p1,poLL  p2,poLL  p0)
{
	LL x1=p1.x-p0.x,y1=p1.y-p0.y;
	LL x2=p2.x-p0.x,y2=p2.y-p0.y;
	return (double)(x1*x2+y1*y2)/(sqrt(x1*x1+y1*y1)*sqrt(x2*x2+y2*y2));
}
void calc()
{
	if(top==0) for(LL  i=1;i<=top;i++) ans[p[sta[i]].num]=0.5;
	else
	{
		sta[0]=sta[top];sta[top+1]=sta[1];
		for(LL  i=1;i<=top;i++)
		{
			double tmp=get(p[sta[i-1]],p[sta[i+1]],p[sta[i]]);
			double s=pi-acos(tmp);
			ans[p[sta[i]].num]=s/(pi*2);
		}
	}
}
int  main()
{
	scanf("%lld",&n);
	for(LL  i=1;i<=n;i++) scanf("%lld %lld",&p[i].x,&p[i].y),p[i].num=i;
	if(n==1) return puts("1.000000000000"),0;
	solve();calc();
	for(LL i=1;i<=n;i++) printf("%.9Lf\n",ans[i]);
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>

using namespace std;

int x[100000];

int main() {
    int n, a, b, i;
    long long ans = 0;
    
    scanf("%d %d %d", &n, &a, &b);
    
    for (i = 0; i < n; i++) scanf("%d", &x[i]);
    
    for (i = 1; i < n; i++) ans += min((long long)(x[i] - x[i - 1]) * a, (long long)b);
    
    printf("%lld\n", ans);
    
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <unordered_map> 
#define io ios::sync_with_stdio(false);cin.tie(0); cout.tie(0);
#define int long long
#define sp " "
#define fi freopen("bruh.txt","r",stdin);
#define fo freopen("input.txt", "w", stdout);
#define pb push_back
#define ff first
#define ss second
#define all(x) x.begin(),c.end();
#define allr(x) x.rbegin(), x.rend()
#define pii pair< int , int >
#define rep(i,a,n) for(int i=a;i<n;i++)
#define rev(i,n,a)for(int i=n;i>=a;i--)
#define mem(ara,a) memset(ara,a,sizeof (ara))
long long inf=2e18;
long long minf=-inf;
using namespace std;

signed main(){
int n , m=0;
cin >> n;

int cnt[n+3];
mem(cnt,0);
for(int i=1;i<n;i++){
    int a;
    cin>> a;
    cnt[a]++;
}
for(int i=1;i<=n;i++){
    cout<<cnt[i]<<endl;
}

}

Measured memory_bytes: 5188
#include <iostream>
#include <vector>
#include <string>

using namespace std;
using ll = long long;

int main(){
  string s;
  cin >> s;
  string ans = "No";

  if(s[0] == 'A'){
    if(s[1] == 'B' || s[2] == 'B'){
      ans = "Yes";
    }
  }

  if(s[0] == 'B'){
    if(s[1] == 'A' || s[2] == 'A'){
      ans = "Yes";
    }
  }


  cout << ans << endl;

  return 0;
}


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

using namespace std;

#define FOR(i,a,b) for(int i = (a); i <= (b); ++i)
#define FORD(i,a,b) for(int i = (a); i >= (b); --i)
#define RI(i,n) FOR(i,1,(n))
#define REP(i,n) FOR(i,0,(n)-1)
#define mini(a,b) a=min(a,b)
#define maxi(a,b) a=max(a,b)
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define sz(w) (int) w.size()
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<pii, int> para;
const int inf = 1e9 + 7;
const int maxN = 5e6 + 5;

int a,b,c,d,e,f;
int main() {
	ios_base::sync_with_stdio(0);
	cin >> a >> b;
	if (a > b) swap(a, b);
	if (a == 1) {
		if(b == 2) cout << 3 << endl;
		else cout << 2 << endl;
	} else cout << 1 << endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
    int l[10],r[10]={-1};
    int i,j,k,c[10],n=0;
    for(i=0;i<10;i++){
        c[i]=11;
    }
    for(i=0;i<10;i++){
        scanf("%d",&l[i]);
    }
    for(j=0;j<10;j++){
        for(i=0;i<10;i++){
            for(k=0;k<10;k++){
                if(c[k]==i){
                    n=1;
                }
            }
            if(!(n==1)){
                if(l[i]>=r[j]){
                    r[j]=l[i];
                    c[j]=i;
                }
            }
            n=0;
        }
    }
    for(i=0;i<3;i++){
        printf("%d\n",r[i]);
    }
    return 0;
}

Measured memory_bytes: 2692
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define out(x) cout << x << '\n'
#define lli long long int
#define uli unsigned long long int
#define rep(i, m, n) for (lli i = m; i < (n); i++)
#define repe(i, m, n) for (lli i = m; i <= (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((lli)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define _GLIBCXX_DEBUG
const lli INF = 2147483647;
const lli MINF = -2147483648;
const lli LINF = 9223372036854775807;
const lli MOD = 1000000007; //10^9+7
const double PI = acos(-1);
#define SORT(n) sort(n.begin(), n.end())
#define SORTR(n) sort(n.begin(), n.end(), greater<int>())
#define REV(n) reverse(n.begin(), n.end())
#define pb push_back
#define eb emplace_back
#define mp make_pair
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vlli = vector<lli>;
using vvli = vector<vlli>;
using vs = vector<string>;
using vvs = vector<vs>;
using vb = vector<bool>;
using vvb = vector<vb>;
using ll = long long;
//---------------------------------------------------------------------------------------------------
// vector入力
template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
  for (T &x : vec)
    is >> x;
  return is;
}
// vector出力
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec)
{
  // os << '{';
  for (int i = 0; i < vec.size(); i++)
  {
    os << vec[i] << (i + 1 == vec.size() ? "" : "");
  }
  // os << '}';
  return os;
}
// aよりもbが大きいならばaをbで更新する(更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T &b)
{
  if (a < b)
  {
    a = b; // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する(更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T &b)
{
  if (a > b)
  {
    a = b; // aをbで更新
    return true;
  }
  return false;
}
//---------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------
void solve()
{
  lli a = 0, b = 0, c = 0, h = 0, n = 0, w = 0, ans = 0, count = 0;
  string s = "", t = "";
  vector<pair<lli, lli>> pr;
  map<lli, lli> ma;
  set<lli> st;

  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n;
  vlli d(n);
  rep(i, 0, n)
  {
    cin >> d[i];
  }
  rep(i, 0, n)
  {
    if (d[i] >= d[i + 1] && d[i] >= count)
    {
      count = d[i];
      // out(count);
    }
    else if (count > 0 && d[i] < count)
    {
      ans += count - d[i];
    }
  }
  out(ans);
}

//---------------------------------------------------------------------------------------------------
signed main()
{
  solve();
}

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

int main(){
  string S = "";
  cin >> S;
  int len = S.size();
  
  string sub;
  for(int i=1; i<len-1; i++){
    sub = S.substr(0,len-i);
    int sub_len = sub.size();
    int subsub_len;
    if(sub_len % 2 == 0){
      subsub_len = sub.size() / 2;
    }
    else{
      continue;
    }
    
    
    string sub1="";
    string sub2="";
    sub1 = sub.substr(0,subsub_len);
    sub2 = sub.substr(subsub_len);
    if(sub1 == sub2){
      cout << sub_len << endl;
      break;
    }
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<string>
#include<vector>
using namespace std;
 
int main(void) {
	int a, b, c;
	cin >> a >> b >> c;
	int color = 3;
	if (a == b || b == c || c == a)color--;
	if (a == b && b == c && c == a)color--;
	cout << color << endl;
	return 0;
}

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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector< pair<int, int> > a(n);
	for (int i = 0; i < n; i++) {
		int x, l;
		cin >> x >> l;
		a[i].first = x - l;
		a[i].second = x + l;
	}
	sort(a.begin(), a.end(), [&](const auto &x, const auto &y) {
		if (x.second == y.second) return x.first < y.first;
		return x.second < y.second;
	});
	int r = a[0].second;
	int ans = 1;
	for (int i = 1; i < n; i++) {
		if (a[i].first < r) continue;
		ans++;
		r = a[i].second;
	}
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static int modP = 1000000007;

	static class TaskX {
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			int[] an = in.nextIntArray(3);
			Arrays.sort(an);
			int s1 = an[2]-an[0];
			int s2 = an[2]-an[1];

			int ans = 0;
			if ((s1 + s2) % 2 == 0) {
				ans = (Math.abs(s1 + s2)) / 2;
			} else {
				an[0]++;
				an[2]++;
				s1 = an[2]-an[0];
				s2 = an[2]-an[1];
				ans = (Math.abs(s1 + s2)) / 2 + 1;
			}

			out.println(ans);

		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}

	}

}


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

#define for_(i,a,b) for(int i=(a);i<(b);++i)

struct Edge { int to, c; };

struct State {
	int u, v, o, c;
	bool operator > (const State& s) const { return c > s.c; }
};

int n, m, fee[55], h[55], cnt[1010], hid[55], dst[55][55][1 << 10];
vector< vector< Edge > > edges[2];

void solve() {
	for_(i,0,n) for_(j,0,n) for_(S,0,1<<10) dst[i][j][S] = (int)1e9;
	
	priority_queue< State, vector< State >, greater< State > > que;
	que.push(State{0, 0, 1, 0});
	dst[0][0][1] = 0;
	
	while (!que.empty()) {
		State s = que.top(); que.pop();
		
		if (dst[s.u][s.v][s.o] < s.c) continue;
		
		int pd = (h[s.u] == h[s.v] ? -1 : (h[s.u] < h[s.v] ? 0 : 1));
		int lv = (pd == 0 ? s.u : s.v), hv = (pd == 0 ? s.v : s.u);
		
		if (pd == -1) {
			for (Edge e : edges[0][s.u]) {
				int no = s.o, cst = s.c + e.c;
				
				if (h[e.to] > h[s.u]) {
					no = 1 << hid[e.to];
					cst += fee[e.to];
				} else {
					cst += (no >> hid[e.to] & 1 ? 0 : fee[e.to]);
					no |= 1 << hid[e.to];
				}
				
				if (dst[e.to][s.v][no] > cst) {
					dst[e.to][s.v][no] = cst;
					que.push(State{e.to, s.v, no, cst});
				}
			}
			
			for (Edge e : edges[1][s.v]) {
				int no = s.o, cst = s.c + e.c;
				
				if (h[e.to] > h[s.v]) {
					no = 1 << hid[e.to];
					cst += fee[e.to];
				} else {
					cst += (no >> hid[e.to] & 1 ? 0 : fee[e.to]);
					no |= 1 << hid[e.to];
				}
				
				if (dst[s.u][e.to][no] > cst) {
					dst[s.u][e.to][no] = cst;
					que.push(State{s.u, e.to, no, cst});
				}
			}
		} else {
			for (Edge e : edges[pd][lv]) {
				int no = s.o, cst = s.c + e.c;
				
				if (h[e.to] < h[hv] || h[e.to] > h[hv]) cst += fee[e.to];
				else cst += (no >> hid[e.to] & 1 ? 0 : fee[e.to]);
				
				if (h[e.to] > h[hv]) no = 1 << hid[e.to];
				if (h[e.to] == h[hv]) no |= 1 << hid[e.to];
				
				int nu = (pd == 0 ? e.to : s.u), nv = (pd == 0 ? s.v : e.to);
				
				if (dst[nu][nv][no] > cst) {
					dst[nu][nv][no] = cst;
					que.push(State{nu, nv, no, cst});
				}
			}
		}
	}
	
	cout << (dst[n - 1][n - 1][1] == (int)1e9 ? -1 : dst[n - 1][n - 1][1]) << endl;
}

int main() {
	while (cin >> n >> m, n) {
		fee[0] = fee[n - 1] = 0;
		h[0] = 0; h[n - 1] = 1000;
		
		memset(cnt, 0, sizeof(cnt));
		
		for_(i,2,n) {
			cin >> fee[i - 1] >> h[i - 1];
			hid[i - 1] = cnt[ h[i - 1] ]++;
		}
		
		for_(i,0,2) edges[i].assign(n, vector< Edge >());
		
		for_(i,0,m) {
			int u, v, c;
			cin >> u >> v >> c;
			--u; --v;
			
			if (h[u] <= h[v]) edges[0][u].push_back(Edge{v, c});
			if (h[u] >= h[v]) edges[1][v].push_back(Edge{u, c});
		}
		
		solve();
	}
}

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

const ll INF = 1LL << 62;
const double PI = acos(-1);
const double eps = 1e-10;

int main() {
  ll cnt = 0, ans = 0;
  string s;
  cin >> s;
  rep(i, 3) {
    if (s[i] == 'R')
      cnt++;
    else
      ans = max(ans, cnt), cnt = 0;
  }
  ans = max(ans, cnt);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3592
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREP1(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(c) begin(c), end(c)

int _ = (
#ifndef LOCAL
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false),
#endif
    std::cout.precision(10), std::cout.setf(std::ios::fixed));

using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <typename T> using vec = std::vector<T>;
using namespace std;

int main() {
  int N, M;
  cin >> N >> M;

  constexpr int INF = numeric_limits<int>::max();
  int lmax = -1, rmin = INF;
  REP(i, M) {
    int L, R;
    cin >> L >> R;
    lmax = max(lmax, L), rmin = min(rmin, R);
  }
  const int rest = rmin - lmax + 1;
  cout << (rest <= 0 ? 0 : rest) << endl;
  return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = (a); i <= (b); i++)
#define rng(a) a.begin(), a.end()
#define ina(n,a) cin >> n; for(int i = 1; i <= n; i++) cin >> a[i]
#define sz(x) (int)(x).size()
#define se second
#define fi first
#define prev            coyhhhhhhyoc    
#define next          sdNNNmNNNNNNNmds  
#define y0           hNNNNy_yNNNNNN_sNh
#define y1          mNNNNNdtdNNNNNNtsNNm
#define yn          mNNNNNNNNy___smNNNms
#define tm            oooooosyysooooot 
#define read               tyhyt        
#define rank              ytmNmo         
#define index              yyy
#define pb push_back
#define pcnt __builtin_popcountll
#define rrep(i,a,b) for(int i = (b); i >= (a); i--)
#define rall(x,a) for(auto x : a)
#define MOD 1000000007
#define endl "\n"
typedef long long ll;
using namespace std;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int a, b, c;
    cin >> a >> b >> c;
    swap(a, b);
    swap(a, c);
    cout << a << " " << b << " " << c << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.lang.*;
// ArrayList<Integer>[] arr=new ArrayList[n];
public class Main{    
public static void main(String[] args) throws FileNotFoundException, IOException{
        Scanner s = new Scanner(System.in);
         StringBuilder sb=new StringBuilder();
         BufferedWriter out=new BufferedWriter(new OutputStreamWriter(System.out));
         int n=s.nextInt();
        Set<Integer>ss=new HashSet<>();
         for(int i=1;i<=9;i++){
            for(int j=i;j<=9;j++){
                ss.add(i*j);
            }
         }
         if(ss.contains(n)){
            System.out.println("Yes");
         }
         else{System.out.println("No");}
       // System.out.println(sb);
    }
}

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

using namespace std;

#define int long long

signed main() {
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  bool f = 1;
  while (a > 0 && c > 0) {
    if (f) {
      c -= b;
      if (c <= 0) {
        cout << "Yes" << '\n';
        return 0;
      }
    }
    else {
      a -= d;
      if (a <= 0) {
        cout << "No" << '\n';
        return 0;
      }      
    }
    // cout << a << ' ' << b << ' ' << f << '\n';
    f = 1 - f;
  }

  return 0;
}

Measured memory_bytes: 3652
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    X, Y = map(int, readline().split())

    a = X
    ans = 1
    while X * 2 <= Y:
        X *= 2
        ans += 1

    print(ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 61876
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder
{
	public class ABC
	{
		static int mod = 1000000007;  // 10^9+7

		static void Main(string[] args)
		{
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });


			//int n = int.Parse(Console.ReadLine());
			//string s = Console.ReadLine();
			int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			//long[] vs = Console.ReadLine().Split().Select(long.Parse).ToArray();
			int x = vs[0];
			int y = vs[1];
			Console.WriteLine(x + y / 2);


			Console.Out.Flush();
		}
	}
}


Measured memory_bytes: 13396
#include<bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define mod 1000000007
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
int main(){
FASTIO	
int n;
cin>>n;
map<ll,ll> m;
vector<ll> a(n);
for(int i=0;i<n;i++){
    cin>>a[i];
    if(m.find(a[i])==m.end()){
    	m[a[i]]=1;
    }
    else{
    	m[a[i]]++;
    }
}
map<ll,ll>:: iterator it=m.begin();
ll ans=0;
map<ll,ll> m1;
while(it!=m.end()){
	ll p=it->ss;
	//ll p1=p-1;
	ll ans1=0;
    ans1=ans1+((p*(p-1))/2);
    ans+=ans1;
    m1[it->ff]=ans1;
    it++;
}
vector<ll> ans2(n);
for(int i=0;i<n;i++){
	ll p=m[a[i]];
	ll p1=p-1;
    ans2[i]=(ans-m1[a[i]]);
    if(p1>0){
    	ans2[i]+=((p1*(p1-1))/2);
    }
}
for(int i=0;i<n;i++)
    cout<<ans2[i]<<"\n";
return 0;
}

Measured memory_bytes: 20608
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline int my_getchar_unlocked(){
  static char buf[1048576];
  static int s = 1048576;
  static int e = 1048576;
  if(s == e && e == 1048576){
    e = fread_unlocked(buf, 1, 1048576, stdin);
    s = 0;
  }
  if(s == e){
    return EOF;
  }
  return buf[s++];
}
inline void rd(long long &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = my_getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = my_getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
struct MY_WRITER{
  char buf[1048576];
  int s;
  int e;
  MY_WRITER(){
    s = 0;
    e = 1048576;
  }
  ~MY_WRITER(){
    if(s){
      fwrite_unlocked(buf, 1, s, stdout);
    }
  }
}
;
MY_WRITER MY_WRITER_VAR;
void my_putchar_unlocked(int a){
  if(MY_WRITER_VAR.s == MY_WRITER_VAR.e){
    fwrite_unlocked(MY_WRITER_VAR.buf, 1, MY_WRITER_VAR.s, stdout);
    MY_WRITER_VAR.s = 0;
  }
  MY_WRITER_VAR.buf[MY_WRITER_VAR.s++] = a;
}
inline void wt_L(char a){
  my_putchar_unlocked(a);
}
inline void wt_L(long long x){
  int s=0;
  int m=0;
  char f[20];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    my_putchar_unlocked('-');
  }
  while(s--){
    my_putchar_unlocked(f[s]+'0');
  }
}
template<class S, class T> inline S divup_L(S a, T b){
  return (a+b-1)/b;
}
int main(){
  long long H;
  long long W;
  long long res;
  rd(H);
  rd(W);
  res =divup_L((H*W),2);
  if(H==1 || W==1){
    res = 1;
  }
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20200314-1

// --- original code ---
// {
//   ll H, W, res;
//   rd(H,W);
//   res = (H*W) /+ 2;
//   if(H==1 || W==1) res = 1;
//   wt(res);
// }


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

int main(){
    bool a[26];
    for(int i=0;i<26;i++){
        a[i]=true;
    }
    string s;
    cin >> s;
    char ch ='a';
    int val;
    for(int i=0;i<s.size();i++){
        val = s[i]-ch;
        if(a[val]==false){
            cout << "no" <<endl;
            return 0;
        }
        a[val]=false;
    }
    cout << "yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
//for(int i = 0; i<n; i++)


int main()
{
    int h,w;cin>>h>>w;
    cout << string(w + 2, '#') << endl;
    for(int i = 0; i< h; i++){
        string s;cin>>s;
        cout << '#' << s << '#' << endl;
    }
    cout << string(w + 2, '#') << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll a,b;
	cin >> a >> b;
	
	ll soma = min(a,b/2);
	b-=2*soma;
	a-=soma;
	if(b>=2)
		soma += b/4;
	cout<<soma;

}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
MIN_A = min(map(abs, A))
MINUS = 0

for i in A:
  if i < 0:
    MINUS += 1

if min(A) > 0:
  print(sum(A))
  exit(0)
  
ans = 0
if MINUS % 2 == 0:
  for a in A:
    ans += abs(a)
else:
  for a in A:
    ans += abs(a)
  ans -= MIN_A * 2

print(ans)
  
  


Measured memory_bytes: 14412
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    int n;
    cin >> n;
    VVI ans(n, VI(n));
    REP(b,10){
        VI g1, g2;
        REP(i,n){
            if (((i >> b) & 1) == 0) g1.push_back(i);
            else g2.push_back(i);
        }
        // for (int x : g1) cout << x << " ";
        // cout << endl;
        if (g2.empty()) continue;
        for (int x : g1) for (int y : g2) ans[x][y] = ans[y][x] = b + 1;
    }
    REP(i,n-1){
        FOR(j,i+1,n-1) cout << ans[i][j] << " ";
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fi first
#define se second
#define pb push_back
#define debug(x) cerr << #x << ": " << x << endl
#define debug_vec(v) cerr << #v << ":"; rep(i, v.size()) cerr << " " << v[i]; cerr<<endl
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

void solve() {
    string s, t;
    cin >> s >> t;
    int cnt = 0;
    rep(i, s.size()) {
        if (s[i] != t[i]) cnt++;
    }
    cout << cnt << endl;
}

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


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

int main() {
  int N;
  cin>>N;
  vector<string> s(N);
  for(int i=0;i<N;i++){
    cin>>s.at(i);
  }
  
  int M;
  cin>>M;
  vector<string> t(M);
  for(int i=0;i<M;i++){
    cin>>t.at(i);
  }
  
  int ans=0;
  
  vector<int> x(N);
  for(int i=0;i<N;i++){
    
    for(int j=0;j<N;j++){
      if(s.at(i)==s.at(j))x.at(i)++;
    }
    
    for(int j=0;j<M;j++){
      if(s.at(i)==t.at(j))x.at(i)--;
    }
    if(x.at(i)>ans)ans=x.at(i);
  }
  cout<<ans<<endl;
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  if (s[0] == s[1] && s[1] == s[2]) cout << "Yes\n";
  else if (s[1] == s[2] && s[2] == s[3]) cout << "Yes\n";
  else cout << "No\n";
  return 0;
}


Measured memory_bytes: 256
//include,using,define等
#pragma region header
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
#include <cstring>
// ===============================================================
//using系
#pragma region header
using namespace std;
using ll = long long;
using lint = long long;
using ld = long double;
using ulint = unsigned long long;
const int dx[] = { 1,0,-1,0 };
const int dy[] = { 0,1,0,-1 };
constexpr lint mod = 1000000007;
constexpr long double pi = 3.141592653589793238462643383279;
#pragma endregion
// ========================================================================
//define
#define INF (lint)10000000000000000
#define mod = (int)1000000007;
#pragma endregion
lint n;
vector<lint> d;
void input() {
	cin >> n;
	d.resize(n);
	for (int i = 0; i < n; i++)
		cin >> d[i];
	return;
}
unsigned long long gcd(unsigned long long a, unsigned long long b) {
	if (a % b == 0)
		return b;
	else
		return gcd(b, a % b);
}
ulint lcm(ulint a, ulint b) {
	return a / gcd(a, b) * b;
}
unsigned long long solve() {
	if (n == 1) return d[0];
	unsigned long long ans;
	ans = lcm(d[0], d[1]);
	for (int i = 2; i < n; i++) {
		ans = lcm(ans, d[i]);
	}
	return ans;
}

int main(void) {
	input();
	printf("%llu\n", solve());

	return 0;
}

Measured memory_bytes: 3744
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

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

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

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

fn main() {
    input!{
        a: [u32;5],
    };
    let mut x = 0;
    let ret = a.iter().map(|a| {
        match a%10 {
            0 => a.clone(),
            _ => {
                if x < 10-a%10 { x = 10-a%10}
                a+10-a%10
            },
        }
    }).sum::<u32>();
    println!("{}", ret-x);
}


Measured memory_bytes: 4352
#include <stdio.h>

main(){
        int n,key,head,tail;
        long data[101];
        int hikaku=0;

        int i;




        while(1){
                scanf("%ld",&n);
                if(n==0)break;
                for(i=0;i<n;i++)
                        scanf("%ld",&data[i]);
                scanf("%d",&key);
                head=0;
                tail=n-1;
                i=(head+tail)/2;
                hikaku=0;
                for(;tail-head>=0;i=(tail+head)/2){
                        //printf("h,t,i %d %d %d\n",head,tail,i);
                        hikaku++;
                        if(data[i]<key)
                                head=i+1;
                        else if(data[i]>key)
                                tail=i-1;
                        else
                                break;

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

        return 0;
}

Measured memory_bytes: 600
N,X,Y=map(int,input().split())
ans=[0]*(N-1)
for i in range(1,N):
	for j in range(i+1,N+1):
		d1=j-i
		d2=abs(X-i)+1+abs(Y-j)
		d=min(d1,d2)
		ans[d-1]+=1
for i in ans:
	print(i)

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

#define int long long
using ll = long long;
using ld = long double;
using intpair = pair<int, int>;
using intmap = map<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
const int MOD = 1e9 + 7;
inline int mod (ll a, int m = MOD) { return (a % m + m) % m; }
inline bool bit (ll b, ll i) { return b & (1 << i); }
inline ll ceiv (ll a, ll b) { return (a + b - 1) / b; }
//struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;

#define debug(x) cerr << #x << ": " << x << '\n'
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()

class UnionFind {
    vector<int> par, treesize;
    int groups;
    
public:
    UnionFind(int n){
        rep(i, n) par.push_back(i);
        treesize = vector<int>(n,1);
        groups = n;
    }
    
    int root(int x){
        if(x == par[x]) return x;
        return par[x] = root(par[x]);
    }
    
    bool same(int x, int y){
        return root(x) == root(y);
    }
    
    void unite(int x, int y){
        if(same(x,y)) return;
        int rx = root(x), ry = root(y);
        treesize[ry] += treesize[rx];
        treesize[rx] = 0;
        groups--;
        par[rx] = ry;
    }
    
    int get_size(int x){
        return treesize[root(x)];
    }
    
    int get_groups(){ return groups; }
};

signed main() {
    int n, m;
    cin >> n >> m;
    UnionFind uf(n);
    while(m--){
        int a, b;
        cin >> a >> b;
        uf.unite(a-1, b-1);
    }
    int ans = 0;
    rep(i,n){
        ans = max(ans, uf.get_size(i));
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 12632
class MyQueue():
    def __init__(self):
        self.queue = []
    def enqueue(self, item):
        self.queue.append(item)
    def dequeue(self):
        if len(self.queue) == 0:
            return None
        result = self.queue[0]
        del self.queue[0]
        return result

n, q = map(int, input().split())
name = [0] * n
time = [0] * n
for i in range(n):
    name[i], time[i] = input().split()


myqueue_name = MyQueue()
myqueue_time = MyQueue()
for i in range(n):
    myqueue_name.enqueue(name[i])
    myqueue_time.enqueue(int(time[i]))

count = 0
roop = 0
sum_time = 0
while count != n:
    x = myqueue_name.dequeue()
    y = myqueue_time.dequeue()
    if y <= q:
        count += 1 #抜けた数
        sum_time += y #yだけ加算
        print(x, sum_time)
    else:
        roop += 1
        sum_time += q #限界値
        myqueue_name.enqueue(x)
        myqueue_time.enqueue(y - q)



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

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

template <class T>
struct Point {
    typedef Point P;
    T x, y;
    explicit Point(T x=0, T y=0) : x(x), y(y) {}
    bool operator<(P p) const { return tie(x,y) < tie(p.x,p.y); }
    bool operator==(P p) const { return tie(x,y)==tie(p.x,p.y); }
    P operator+(P p) const { return P(x+p.x, y+p.y); }
    P operator-(P p) const { return P(x-p.x, y-p.y); }
    P operator*(T d) const { return P(x*d, y*d); }
    P operator/(T d) const { return P(x/d, y/d); }
    T dot(P p) const { return x*p.x + y*p.y; }
    T cross(P p) const { return x*p.y - y*p.x; }
    T cross(P a, P b) const { return (a-*this).cross(b-*this); }
    T dist2() const { return x*x + y*y; }
    double dist() const { return sqrt((double)dist2()); }
    // angle to x-axis in interval [-pi, pi]
    double angle() const { return atan2(y, x); }
    P unit() const { return *this/dist(); } // makes dist()=1
    P perp() const { return P(-y, x); } // rotates +90 degrees
    P normal() const { return perp().unit(); }
    // returns point rotated 'a' radians ccw around the origin
    P rotate(double a) const {
        return P(x*cos(a)-y*sin(a),x*sin(a)+y*cos(a)); }
};

typedef Point<ll> P;
pair<vi, vi> ulHull(const vector<P>& S) {
    vi Q(sz(S)), U, L;
    iota(all(Q), 0);                                                                                                                                                                         
    sort(all(Q), [&S](int a, int b){ return S[a] < S[b]; }); 
    trav(it, Q) {
#define ADDP(C, cmp) while (sz(C) > 1 && S[C[sz(C)-2]].cross(\
    S[it], S[C.back()]) cmp 0) C.pop_back(); C.push_back(it);
        ADDP(U, <=); ADDP(L, >=);
    }   
    return {U, L}; 
}

vi convexHull(const vector<P>& S) {
    vi u, l; tie(u, l) = ulHull(S);
    if (sz(S) <= 1) return u;
    if (S[u[0]] == S[u[1]]) return {0};
    l.insert(l.end(), u.rbegin()+1, u.rend()-1);
    return l;
}

const double PI = 4.0*atan(1.0);

double fix(double angle){
    if(angle > 2.0*PI) return fix(angle - 2.0*PI);
    if(angle < 0) return fix(angle + 2.0*PI);
    return angle;
}

int main(){
    int n;
    cin >> n;
    vector<P> s(n);
    for(int i = 0; i < n; i++){
        cin >> s[i].x >> s[i].y;
    }
    vector<double> ans(n, 0.0);
    vector<int> hull = convexHull(s);
    int g = hull.size();
    for(int i = 0; i < hull.size(); i++){
        double ang = (s[hull[(i+1)%g]] - s[hull[i]]).angle()
            - (s[hull[i]] - s[hull[(g+i-1)%g]]).angle();
        ang = fix(ang);
        ans[hull[i]] = ang / 2.0/PI;
    }
    cout << fixed << setprecision(15);
    for(int i = 0; i < n; i++){
        cout << ans[i] << '\n';
    }
}


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

int N, A, B, C; 
int l[8];
int L[3] = {0,0,0};

int MP(int index){
   if(index==N) {
      if(L[0]*L[1]*L[2]==0) return 1<<28;
      else return abs(A-L[0]) + abs(B-L[1]) + abs(C-L[2]);
   }

   //assume l[index] is used for A
   L[0] += l[index];
   int mp = 10 + MP(index+1);
   L[0] -= l[index];

   //assume l[index] is used for B
   L[1] += l[index];
   mp = std::min(mp, 10 + MP(index+1));
   L[1] -= l[index];

   //assume l[index] is used for C
   L[2] += l[index];
   mp = std::min(mp, 10 + MP(index+1));
   L[2] -= l[index];

   //assume l[index] is not used
   mp = std::min(mp, MP(index+1));
   return mp;
}

int main(){
   std::cin >> N >> A >> B >> C;
   for(int i=0; i<N; ++i)
      std::cin >> l[i];
   
   std::cout << MP(0) - 30 << std::endl;
   return 0;
}


Measured memory_bytes: 256
from itertools import product

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

x = []
for i in range(m):
    x.append(list(map(int, input().split()))[1:])

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

ans = 0
for j in product([1,0],repeat=n):
    for i, s in enumerate(x):
        if sum([j[k-1] == 1 for k in s]) % 2 != p[i]:
            break
            
    else:
        ans += 1

print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e3+5;
const ll p = 1e9+7;

int a, b;
int main(){
    #ifdef Irene
    freopen("in.txt", "r", stdin);
    #endif // Irene
    //ios_base::sync_with_stdio(false);

    map<int, int> mp;
    mp[1] = 300000;
    mp[2] = 200000;
    mp[3] = 100000;
    cin >> a >> b;
    cout << mp[a] + mp[b] + (a == 1 && b == 1 ? 400000 : 0) << "\n";
}


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

using namespace std;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	vector<int> x(5);
	for (int i = 0; i < 5; ++i) cin >> x[i];
	for (int i = 0; i < 5; ++i) if (!x[i]) return cout << i + 1, 0; 
}

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

const int maxn = 109;
int a[maxn], mx = -1e9, mn = 1e9;
int pmx, pmn, n;
int x[maxn], y[maxn], res;

int main() {
	scanf("%d", &n);
	for (int i=1; i<=n; i++) {
		scanf("%d", &a[i]);
		if (a[i] > mx) {
			mx = a[i]; pmx = i;
		}
		if (a[i] < mn) {
			mn = a[i]; pmn = i;
		}
	}
	if (abs(mx) > abs(mn)) {
		x[++res] = pmx; y[res] = 1;
		x[++res] = pmx; y[res] = 1;
		for (int i=2; i<=n; i++) {
			x[++res] = i-1; y[res] = i;
			if (a[i] < 0) {
				x[++res] = i-1; y[res] = i;
			}
		}
	}
	else {
		x[++res] = pmn; y[res] = n;
		x[++res] = pmn; y[res] = n;
		for (int i=n-1; i>=1; i--) {
			x[++res] = i+1; y[res] = i;
			if (a[i] > 0) {
				x[++res] = i+1; y[res] = i;
			}
		}
	}
	printf("%d\n", res);
	for (int i=1; i<=res; i++)
		printf("%d %d\n", x[i], y[i]);
	return 0;
}

Measured memory_bytes: 256
k=int(input())
sum=0

def gcd(x,y):
  while y!=0:
    x,y=y,x%y
  return x
    
for i in range(1,k+1):
  for j in range(1,k+1):
    for z in range(1,k+1):
      sum+=gcd(i,gcd(j,z))
      
print(sum)

Measured memory_bytes: 68692
N=int(input())
ans = [0] * (N+1)

for x in range(1,10000):
    if 6*x*x > N:
        break
    for y in range(x,10000):
        if x*x + 3*y*y + 2*x*y > N:
            break
        for z in range(y,10000):
            v = x*x + y*y + z*z + x*y + y*z + x*z
            if v > N:
                break
            if x == y and y == z:
                ans[v] += 1
            elif x != y and y != z:
                ans[v] += 6
            else:
                ans[v] += 3

for i in range(1,N+1):
    print(ans[i])


Measured memory_bytes: 9304
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)1e18;
const double PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	int N;
	cin >> N;
	vector<LL> A(N),B(N);
	for(int i=0;i<N;++i){
		cin >> A[i] >> B[i];
	}
	LL ans = 0;
	for(int i=N-1;i>=0;--i){
		LL res = 0;
		res = B[i] - ((A[i]+ans)%B[i]);
		res %= B[i];

		ans += res;
	}
	cout << ans << endl;
}
#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	
	
	solve();
}
#pragma endregion //main()


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

using namespace std;

/*-------------------------------*/
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (b) - 1; i >= (a); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define RREP(i, n) for(int i = (n) - 1; i >= 0; i--)
#define all(i) (i).begin(),(i).end()
#define pb push_back
#define mp make_pair

typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef vector<long long> llv;
typedef vector<pint> vpint;

int gcd(int a, int b){return b?gcd(b, a % b):a;}
/*-------------------------------*/

int main(void)
{
  int h, m, s;
  int x, y;
  int ans[3];

  REP(i, 3){
    cin >> h >> m >> s;
    x = (h * 3600) + (m * 60) + s;
    cin >> h >> m >> s;
    y = (h * 3600) + (m * 60) + s;
    y -= x;
    ans[i] = y;
  }

  REP(i, 3){
    cout << ans[i] / 3600 << " ";
    ans[i] %= 3600;
    cout << ans[i] / 60 << " ";
    ans[i] %= 60;
    cout << ans[i] << endl;
  }

  return (0);
}

Measured memory_bytes: 3028