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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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 ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;

ll dp[100005][2]; // i桁目まで見たとき、 j==0: i桁目まで一致している、j==1: 未満であることが確定している 通り数

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  string s; cin>>s;
  ll n=s.size();
  
  dp[0][0]=1;
  
  rep(i,n){
    // a+b == 0
    if(s[i]=='0'){
      dp[i+1][0]=dp[i][0]; // s[i]==0 の時、 a+b==0 なので、i桁目まで一致している通り数 *1 となる
      dp[i+1][1]=dp[i][1]; // 未満となることが確定している通り数を引き継ぐ これは全てのブロックで計算される
    }else{
      // s[i]==1 の時、a+b==0 にする → 未満になる
      // 今見ている桁まで同じ値である数が、未満になる数として通算できる
      dp[i+1][1]=(dp[i][0]+dp[i][1])%MOD;
    }
    
    // a+b == 1
    if(s[i]=='0'){
      (dp[i+1][1]+=dp[i][1]*2%MOD)%=MOD; // a+b==1 とできるのは2通りなので *2
    }else{
      (dp[i+1][0]+=dp[i][0]*2%MOD)%=MOD;
      (dp[i+1][1]+=dp[i][1]*2%MOD)%=MOD;
    }
  }
  ll ans=(dp[n][0]+dp[n][1])%MOD;
  
  cout<<ans<<endl;
}

Measured memory_bytes: 2000
#include <stdio.h>
int main(void){
    int ans=0,w,n,l[300];
    scanf("%d",&n);for(int i=0;i<2*n;i++){
        scanf("%d",&l[i]);
    }
    for(int i=0;i<2*n;i++){
        for(int j=0;j<2*n-i-1;j++){
            if(l[j]<l[j+1]){
                w=l[j];
                l[j]=l[j+1];
                l[j+1]=w;
            }
        }
    }
    for(int i=0;i<n;i++){
        ans+=l[2*i+1];
    }
    printf("%d\n",ans);
    return 0;
}

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

int main()
{
	int A, B;
	cin >> A >> B;
	cout << (A + B) % 24;
	return 0;
}


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

struct union_find{
	vector<int>par;
	vector<size_t>rank;
	explicit union_find(size_t n)
		:par(n,-1),rank(n,0){}
	int find(int a){
		if(par.at(a)<0)return a;
		return par.at(a)=find(par.at(a));
	}
	void unite(int a,int b){
		a=find(a),b=find(b);
		if(a==b)return;
		if(rank.at(a)<rank.at(b)){
			par.at(a)+=par.at(b);
			par.at(b)=a;
		}
		else{
			if(rank.at(a)==rank.at(b))++rank.at(a);
			par.at(b)+=par.at(a);
			par.at(a)=b;
		}
	}
	bool same(int a,int b){
		return find(a)==find(b);
	}
	int size(int i){
		return -par.at(find(i));
	}
};

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n,m; cin>>n>>m;
	union_find 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)ans=max(ans,uf.size(i));
	cout<<ans<<"\n"s;
}

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

typedef std::pair<int, int> ipair;
#define pb push_back
#define ff first
#define ss second
#define fr(i, j, k) for (int i = j; i < k; i++)
#define int long long
#define ld long double
#define cnt_ones(x) __builtin_popcount(x)
#define all(x) x.begin(), x.end()
#define mp make_pair
#define mod 1000000007

template<class T> ostream& operator <<(ostream &out,vector<T> &A){for(auto x:A) out<<x<<" ";return out;}
template <class T1,class T2>T1 powr(T1 a,T2 b){T1 res = 1;fr(i,1,b+1)res = res*a;return res;}
#define IOS  std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int32_t main(){
  int n,k;  cin>>n>>k;
  vector<int> A(n); fr(i,0,n) cin>>A[i];
  vector<bool> dp(k+1,false);
  for(int stones=0;stones<=k;stones++)
    for(auto x : A){
      if(stones>=x and !dp[stones-x])
        dp[stones] = true;
    }
    puts(dp[k] ? "First" : "Second");
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define LL long long
#define REP(i,n) for(int i=0;i<(n);++i)
#define PER(i,n) for(int i=n-1;i>=0;--i)
#define REPA(i,n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define PII pair<int,int>
#define PLI pair<long long, int>
#define PLL pair<long long, long long>
#define MOD ((LL)998244353) 
#define INF ((int)1e9+7)
#define INFLL ((LL)1e18)
#define ALL(x) (x).begin(),(x).end()
#define BIT(x) (1LL << (x))
using namespace std;

LL modpow(LL x, LL b){
	LL res = 1;
	while(b){
		if(b&1)res = res * x % MOD;
		x = x * x % MOD;
		b>>=1;
	}
	return res;
}

LL modinv(LL x){
	return modpow(x, MOD-2);
}

int main(){
	int N, Q;
	cin >> N >> Q;
	vector<vector<int>> roads(N+1);
	REP(i, N-1){
		int a, b;
		cin >> a >> b;
		roads[a].push_back(b);
		roads[b].push_back(a);
	}
	vector<int> touches(N+1, 0);
	REP(i, Q){
		int p, x;
		cin >> p >> x;
		touches[p]+=x;
	}
	queue<PII> que;
	que.push(PII(1, -1));
	while(!que.empty()){
		PII d = que.front();
		que.pop();
		foreach(i, roads[d.first]){
			if(i==d.second)continue;
			touches[i]+=touches[d.first];
			que.push(PII(i, d.first));
		}
	}
	bool flag=false;
	REPA(i, N+1){
		if(flag)cout << " ";
		flag=true;
		cout << touches[i];
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 16372
import collections
from math import factorial

def permutations_count(n, r):
    ''' 順列 '''
    return factorial(n) // factorial(n - r)

def combinations_count(n, r):
    ''' 組み合わせ '''
    return factorial(n) // (factorial(n - r) * factorial(r))


S = input()

lis = []
amari = 1
lis.append(int(S[-1]))

for i in range(2,len(S)+1):
    amari = (amari * 10) % 2019
    lis.append((int(S[-1*i]) * amari + lis[i-2]) % 2019)

c = collections.Counter(lis)

su = 0

for k in c:
    if c[k] > 1:
        su += combinations_count(c[k], 2)
        
        
        
su += c[0]

print(su)

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define int long long
#define b push_back
#define m_p make_pair
#define m_t meke_tuple
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define debg(a) cout<<#a<<" "<<a<<endl;
#define call(a) for(auto i:a)cout<<i<<" ";cout<<endl
#define out(a) cout<<(a)<<endl
#define fi first
#define se second
#define UNIQUE(a) a.erase(unique(all(a)),a.end())
typedef long long ll;
typedef string str;
typedef vector<ll> V;
typedef pair<ll,ll> P;
typedef vector<P> VP;
const long long INF = 1LL<<60;
const long long MOD = 1e9+7;
int gcd(int a,int b){if(b==0)return a;return gcd(b,a%b);}
int lcm(int a,int b){return a/gcd(a,b)*b;}
int max(int a,int b){if(a>b)return a; return b;}
int min(int a,int b){if(a>b)return b; return a;}
void Yes(){cout<<"Yes"<<endl;}
void No(){cout<<"No"<<endl;}
void YN(bool b){cout<<(b?"Yes":"No")<<endl;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  V a(5);
  rep(i,5)cin>>a[i];
  int res=accumulate(all(a),0);
  V m(5);
  int c=4;
  rep(i,5){
      m[i]=10-a[i]%10;
      if(m[i]==10)c--;
  }
  SORT(m);
  //reverse(all(m));
  rep(i,c){
      if(m[i]==10)continue;
      res+=m[i];
  }
  //call(m);
  out(res);
   
 
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
int main()
{
  int h,n;
  cin >> h >> n;
  vector<int> a(n),b(n);
  rep(i,n){
    cin >> a[i] >> b[i];
  }
  const int inf = 1e+9+10;

  vector<vector<int>> dp(n+1,vector<int>(h+1,inf));
  dp[0][h] = 0;
  rep1(i,n){
    for(int j=h;j>=0;--j){
      if(j+a[i-1]>h){
	dp[i][j] = min(dp[i-1][j],b[i-1]);
      }
      else{
	dp[i][j] = min(dp[i-1][j],dp[i][j+a[i-1]]+b[i-1]);
      }
    }
  }

  cout << dp[n][0] << "\n";
  
  
  return 0;
}


Measured memory_bytes: 39424
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] a = new long[n];
		long sum = 0;
		for (int i = 0; i < a.length; i++) {
			a[i] = sc.nextLong();
			sum += a[i];
		}
		
		long min = Long.MAX_VALUE;
		long sum2 = 0;
		for (int i = 0; i < n - 1; i++) {
			sum2 += a[i];
			min = Math.min(min, Math.abs(2 * sum2 - sum));
		}
		
		System.out.println(min);
		
		
	}
}




Measured memory_bytes: 85800
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int prevX = 0;
        int prevY = 0;
        int prevT = 0;
        Thing[] arr = new Thing[n];
        for (int i = 0; i < n; i++) {
            arr[i] = new Thing(scan.nextInt(), scan.nextInt(), scan.nextInt());
        }
        Arrays.sort(arr);

        Thing prev = new Thing(0, 0, 0);
        for (int i = 0; i < n; i++) {
            Thing cur = arr[i];
            int diff = Math.abs(cur.x - prev.x) + Math.abs(cur.y - prev.y);
            int tDiff = cur.t - prev.t;
            if (tDiff % 2 != diff %2 || diff > tDiff) {
                System.out.println("No");
                return;
            }
            prev = cur;
        }
        System.out.println("Yes");
    }
}

class Thing implements Comparable<Thing> {
    int t, x, y;

    public Thing(int t, int x, int y) {
        this.t = t;
        this.x = x;
        this.y = y;
    }

    @Override
    public int compareTo(Thing o) {
        return t - o.t;
    }
}

Measured memory_bytes: 92696
X,K,D = map(int,input().split())
X = abs(X)
 
if X <= K * D :
  if (K - X // D) % 2 == 1 :
    answer = abs(X % D - D)
  else :
    answer = X % D
else :
  answer = X - K * D
  
print(answer)

Measured memory_bytes: 61844
module.exports=function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){"use strict";var n=r(1);r(2)(n.readFileSync("/dev/stdin","utf8"))},function(t,e){t.exports=require("fs")},function(t,e,r){"use strict";var n=r(3),i=r(5);t.exports=function(t){var e=new n(t);i(e)}},function(t,e,r){"use strict";var n=r(4);t.exports=class{constructor(t){var e=t.trim().split(/\s+/g);this.inp=new n(e)}inr(){return this.inp.deq()}in(){return parseInt(this.inp.deq(),10)}fin(){this.inp.clear()}}},function(t,e,r){"use strict";t.exports=class{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.size=t.length,this.items=t,this.ind=0}enq(t){this.size+=1,this.items.push(t)}deq(){var t=this.items[this.ind];return this.size-=1,this.ind+=1,t}clear(){this.items=[],this.size=0,this.ind=0}}},function(t,e,r){"use strict";t.exports=function(t){for(var e=t.in(),r=t.in(),n=new Array(e),i=new Array(e),o=new Array(e),s=0;s<e;s++)n[s]=t.in(),i[s]=t.in(),o[s]=t.in();for(var u=[[1,1,1],[1,1,-1],[1,-1,1],[-1,1,1],[-1,-1,1],[-1,1,-1],[1,-1,-1],[-1,-1,-1]],c=0,a=0;a<8;a++){for(var f=new Array(e),l=0;l<e;l++)f[l]=n[l]*u[a][0]+i[l]*u[a][1]+o[l]*u[a][2];f.sort(function(t,e){return e-t});for(var p=0,d=0;d<r;d++)p+=f[d];c=Math.max(c,p)}console.log(c)}}]);

Measured memory_bytes: 24248
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main()
{
  ll n,k;
  cin>>n;
  ll a[n][3];
  ll i;
   ll dp[n][3];
  for(i=0;i<n;i++)
  {
      for(ll j=0;j<3;j++)
    {  cin>>a[i][j];
      
    dp[i][j]=0;
  }}
 
  dp[0][0]=a[0][0];
   dp[0][1]=a[0][1];
    dp[0][2]=a[0][2];
  //dp[1]=abs(a[0]-a[1]);
  for(i=1;i<n;i++)
  {
      dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i][0];
      dp[i][1]=max(dp[i-1][0],dp[i-1][2])+a[i][1];
      dp[i][2]=max(dp[i-1][0],dp[i-1][1])+a[i][2];
      
  }
  cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
  
  
}

Measured memory_bytes: 4992
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <set>
#include <deque> 
#include <string>


using namespace std;

char s[30];

int main()
{
	scanf("%s", s);
	if ((s[2] == s[3]) && (s[4] == s[5])) {
		printf("Yes\n");
	} else {
		printf("No\n");
	}
	
	
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
using namespace std;
bool s[15][10005] = { 0 };
int ans = 0, n, m;
void dfs(int x)
{
	if (x == n)
	{
		int sum = 0, temp = 0;
		for (int j = 0; j < m; j++)
		{
			for (int i = 0; i < n; i++)
				if (s[i][j] == 1)
					temp++;
			sum += max(temp, n - temp);
			temp = 0;
		}
		ans = max(ans, sum);
		return;
	 }
	dfs(x + 1);
	for (int i = 0; i < m; i++)
		s[x][i] = !s[x][i];
	dfs(x + 1);
}
int main()
{
	while (cin >> n >> m, n, m)
	{
		ans = 0;
		for (int i = 0; i < n; i++)
			for (int j = 0; j < m; j++)
				cin >> s[i][j];
		dfs(0);
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 3144
def solve():
    H, W = map(int, input().split())
    S = [input() for i in range(H)]

    for i in range(H):
        S[i] = list(S[i])

    for i in range(H):
        for k in range(W):

            if S[i][k]!="#":

                c = 0; #counter

                if i>0 and k>0 and S[i-1][k-1]=="#": # upper left
                    c += 1

                if i>0  and S[i-1][k]=="#": # right above
                    c += 1

                if i>0 and k<W-1 and S[i-1][k+1]=="#": # upper right
                    c+= 1

                if k>0 and S[i][k-1]=="#": # left
                    c += 1
           
                if k<W-1 and S[i][k+1]=="#": # right
                    c += 1

                if i<H-1 and k>0 and S[i+1][k-1]=="#": # lower left
                    c += 1

                if i<H-1 and S[i+1][k]=="#": # right under
                    c += 1

                if i<H-1 and k<W-1 and S[i+1][k+1]=="#": # lower right
                    c += 1

                S[i][k] = str(c)

    for i in range(H):
        print("".join(S[i]))


if __name__ == "__main__":
    solve()



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

int main()
{
    ll N, M;
    cin >> N >> M;
    vector<pair<ll, ll>> tasks(N);
    ll a, b;
    rep(i, N)
    {
        cin >> a >> b;
        tasks[i] = make_pair(a, b);
    }
    sort(tasks.rbegin(), tasks.rend());
    priority_queue<ll, vector<ll>, greater<ll>> rsv;
    for (auto t : tasks)
    {
        if (M < t.first)
            continue;
        if (rsv.size() <= M - t.first)
        {
            rsv.push(t.second);
        }
        else
        {
            if (rsv.top() < t.second)
            {
                rsv.pop();
                rsv.push(t.second);
            }
        }
    }
    ll sum = 0;
    while (!rsv.empty())
    {
        sum += rsv.top();
        rsv.pop();
    }
    cout << sum << endl;
    return 0;
}


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

int main(){
    int a,b,c,d;
    cin >> a >> b >> c >>d;
    while(true){
        c-=b;
        if(c<=0){
            cout << "Yes" << endl;
            return 0;
        }
        a-=d;
        if(a<=0){
            cout << "No" << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3516
n = int(input())

keta = 0
tmp = 26
beki = [26]

while True:
    if n <= beki[-1]:
        break
    tmp *= 26
    beki.append(beki[-1] + tmp)
    keta += 1
n_tmp = n
ans_num = []

n_tmp -= beki[keta - 1] + 1
for i in range(keta):
    waru = 26**(keta - i)
    x = (n_tmp) // waru
    ans_num.append(x)
    n_tmp -= x * waru

ans_num.append(n_tmp)
ans = ''

for d in ans_num:
    ans += chr(d + 97)

if n <= 26:
    print(chr(n + 96))
else:
    print(ans)

Measured memory_bytes: 80036
points = []
flag = True
while flag:
    points.append(list(map(int, input().split())))
    if points[-1][0] == points[-1][1] == points [-1][2] == -1:
        flag = False
points.pop()

for p in points:
    if p[0] == -1 or p[1] == -1:
        print('F')
    elif p[0] + p[1] >= 80:
        print('A')
    elif 65 <= p[0] + p[1] < 80:
        print('B')
    elif 50 <= p[0] + p[1] < 65:
        print('C')
    elif 30 <= p[0] + p[1] < 50 and p[2] >= 50:
        print('C')
    elif 30 <= p[0] + p[1] < 50:
        print('D')
    elif p[0] + p[1] <= 30:
        print('F')



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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};

int main()
{
    int n,ansx,ansy,ansh=-1;
    cin>>n;
    vector<int> x(n),y(n),h(n);
    int xx,yy,hh;
    
    for(int i = 0; i < n; i++)
    {
        cin>>x[i]>>y[i]>>h[i];
        if(h[i]>0)
        {
            xx=x[i];
            yy=y[i];
            hh=h[i];
        }
    }
    
    
    for(int tmpx = 0; tmpx < 101; tmpx++)
    {
        for(int tmpy = 0; tmpy < 101; tmpy++)
        {
            bool ok=true;
            bool kakutei =false;
            int tmph = hh + abs(tmpx-xx)+abs(tmpy-yy);
            
            for(int info = 0; info < n; info++)
            {
                int diff= abs(tmpx-x[info])+abs(tmpy-y[info]);
                if(tmph!=diff+h[info])
                {
                    if(h[info]==0 && diff>tmph)
                    {
                        continue;
                    }
                    else
                    {
                        ok=false;
                        break;
                    }
                }
            }
            if(ok)
            {
                ansx=tmpx;
                ansy=tmpy;
                ansh=tmph;
                break;
            }
        }
        if(ansh>0)break;
    }

    cout<<ansx<<" "<<ansy<<" "<<ansh<<endl;
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  int n, x, y; cin >> n >> x >> y; --x; --y;
  vector<int> ans(n, 0);
  REP(i, n) FOR(j, i + 1, n) ++ans[min({j - i, abs(x - i) + 1 + abs(j - y), abs(y - i) + 1 + abs(j - x)})];
  FOR(k, 1, n) cout << ans[k] << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <climits>

using namespace std;

typedef long long ll;

int main() {
    ll N;   cin >> N;
    if (N%2) {
        cout << 0 << endl;
        return 0;
    }

    ll ans = 0;
    ll M = N/2;
    while (M > 0) {
        ans += M/5;
        M /= 5;
    }
    cout << ans << endl;
    return 0;
}

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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)
#define In(vec) rep(i, n) cin>>vec[i];
#define ANS(s) cout << s << endl
#define inc(a, b) cin >> a >> b;

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<ll> vl;
typedef vector<vector<int> > vvi;
typedef vector<pair<int, int> > vii;

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; }

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
int round_int(int a, int b) { return (a + (b - 1)) / b; }


// 4,8方向に探索する際に用いる配列
//int dx[4] = { 0,  0, 1, -1 };
//int dy[4] = { 1, -1, 0,  0 };
//int dx[8] = { 1, 0, -1,  0, 1, -1, -1,  1 };
//int dy[8] = { 0, 1,  0, -1, 1,  1, -1, -1 };


// ────────────────────────────────────────────────────

int main() {
	int c[6];
	int power[6] = { 1, 5, 10, 50, 100, 500 };
	ll all = 0;
	rep(i, 6) {
		cin >> c[i];
		all += c[i] * power[i];
	}
	cout << (all >= 1000) << endl;
}



Measured memory_bytes: 3124
#include <bits/stdc++.h>
#include <atcoder/all>

using namespace std;
using namespace atcoder;

int n, q;

int main() {
  cin >> n >> q;
  dsu d(n);
  while (q--) {
    int cmd, u, v;
    scanf("%d %d %d", &cmd, &u, &v);
    if (cmd) {
      printf("%d\n", (int) d.same(u, v));
    } else {
      d.merge(u, v);
    }
  }
  return 0;
}



Measured memory_bytes: 3996
#include <bits/stdc++.h>
using namespace std;
struct edge {
    int to;     // 辺の行き先
    int weight; // 辺の重み
    edge(int t, int w) : to(t), weight(w) { }
};
using Graph = vector<vector<int>>;
using dou =long double;
string yes="yes";
string Yes="Yes";
string YES="YES";
string no="no";
string No="No";
string NO="NO";

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(ll i = m; i < (ll)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum(a) accumulate(all(a),0ll)
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
#define case std::cout << "Case #" <<qqq+1<<": "
#define res resize
#define as assign
#define ffor for(;;)
#define ppri(a,b) std::cout << a<<" "<<b << std::endl
#define pppri(a,b,c) std::cout << a<<" "<<b <<" "<< c<<std::endl
#define aall(x,n) (x).begin(),(x).begin()+(n)
 
typedef long long ll;
typedef pair<int,int> P;
//typedef long long T;
const int INF = 2000000000;
const ll INF64 = 922337203685477580ll;
const ll MOD = 1000000007ll;
const dou pi=3.141592653589793;
int main(){
    dou r;
    std::cin >> r;
    std::cout << keta(10)<<2*r*pi << std::endl;
}


Measured memory_bytes: 3808
#include <algorithm>     //sort,二分探索,など
#include <bitset>        //固定長bit集合
#include <cmath>         //pow,logなど
#include <complex>       //複素数
#include <deque>         //両端アクセスのキュー
#include <functional>    //sortのgreater
#include <iomanip>       //setprecision(浮動小数点の出力の誤差)
#include <iostream>      //入出力
#include <iterator>      //集合演算(積集合,和集合,差集合など)
#include <map>           //map(辞書)
#include <numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>         //キュー
#include <set>           //集合
#include <stack>         //スタック
#include <string>        //文字列
#include <unordered_map> //イテレータあるけど順序保持しないmap
#include <unordered_set> //イテレータあるけど順序保持しないset
#include <utility>       //pair
#include <vector>        //可変長配列

using namespace std;
typedef long long ll;

//マクロ
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007      //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MAXR 100000 //10^5:最大のrange(素数列挙などで使用)

signed main()
{
  ll Q;
  string S;

  bool is_reversed = false;
  deque< char > deq;

  cin >> S;
  cin >> Q;

  for (int i; i < S.size(); i++)
  {
    deq.push_back(S[i]);
  }

  REP(i, Q)
  {
    ll t;
    cin >> t;
    if (t == 1)
    {
      is_reversed = !is_reversed;
    }
    else if (t == 2)
    {
      ll f;
      char s;
      cin >> f >> s;
      if (f == 1)
      {
        if (!is_reversed)
        {
          deq.push_front(s);
        }
        else
        {
          deq.push_back(s);
        }
      }
      else if (t == 2)
      {
        if (!is_reversed)
        {
          deq.push_back(s);
        }
        else
        {
          deq.push_front(s);
        }
      }
    }
  }

  if (is_reversed)
  {
    reverse(ALL(deq));
  }

  while (!deq.empty())
  {
    char ch = deq.front();
    cout << ch;
    deq.pop_front();
  }
  cout << endl;
}


Measured memory_bytes: 896
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <numeric>
#include <string>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
	int n, a, b;
	cin >> n >> a >> b;
	string s;
	cin >> s;

	int kaigai = 0;
	int gakusei = 0;

	for (int i = 0; i < n; i++) {
		if (s[i] == 'b') kaigai++;

		if (s[i] == 'a' && gakusei < a + b) {
			cout << "Yes" << endl;
			gakusei++;
		}
		else if (s[i] == 'b' && gakusei < a + b && kaigai <= b) {
			cout << "Yes" << endl;
			gakusei++;
		}
		else {
			cout << "No" << endl;
		}

		//if (s[i] == 'c')cout << "No" << endl;
	}
	return 0;
}


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

int P[10010]; //0から10000までの取り扱い可能
int n,q;
 
 int root(int a) { //aのroot(代表元)を求める
   if (P[a] == a) return a; //aはroot
   return (P[a] = root(P[a])); //aの親のrootを求め、aの親とする
  }
  bool is_same_set(int a, int b){ //aとbが同じグループに属するか?
    return root(a) == root(b);
	}
  void unite(int a, int b) { //aとbを同一グループにまとめる
    P[root(a)] = root(b);
	}
	
int main() {
  int x,y,num,check;
  cin >> n >> q;
  for (int j = 0; j < n; j++){
    P[j] = j;
	}
  int a[q];
  for (int l = 0; l < q; l++){
    cin >> num >> x >> y;
       if (num == 0){
	     unite(x,y);
		 }
		else{
		  a[check] = is_same_set(x,y);
		  check++;
		  }
	}
  for (int t = 0; t < check; t++){
    cout << a[t] << endl;
	}
  }

Measured memory_bytes: 1400
#include <iostream>
#include <vector>
#include <typeinfo>
#include <algorithm>
#include <map>
using namespace std;
typedef long long ll;
int main(void){
    int n;
    ll l;
    cin >> n >> l;
    ll ap, ai;
    int x=n;
    for(int i=0; i<n; i++){
        cin >> ai;
        if(i>0){
            if(ap+ai>=l){
                x = i;
                break;
            }
        }
        ap = ai;
    }
    if(x==n){
        cout << "Impossible" << endl;
    }else{
        cout << "Possible" << endl;
        for(int i=1; i<x; i++){
            cout << i << endl;
        }
        for(int i=n-1; i>=x; i--){
            cout << i << endl;
        }
    }
}

Measured memory_bytes: 768
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <iomanip>
#include <numeric>
 
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll N;
map<P,P> AA;
ll ans=1;
ll gcd(ll a, ll b) {
  while(1) {
    if(a < b) swap(a, b);
    if(!b) break;
    a %= b;
  }
  return a;
}
ll M = 1000000007;
ll mpow(ll x, ll n){ //x^n(mod M) ←普通にpow(x,n)では溢れてしまうため，随時mod計算
    ll anss = 1;
    while(n != 0){
        if(n&1) anss = anss*x % M;
        x = x*x % M;
        n = n >> 1;
    }
    return anss;
}


int main(){
    cin >> N;
    ll k;
    ll zeros=0;
    for(int i=0;i<N;i++){
        ll A,B;
        cin >> A >> B;
        if(A==0&&B==0){
            zeros++;
            continue;
        }
        k = gcd(abs(A),abs(B));
        A = A/k;
        B = B/k;
            if(B<0){
                B = -B;
                A = -A;
            }else if(B==0){
                A = 1;
            }
            if(A==0){
                B = 1;
            }
            if(A>0){
                AA[P(A,B)].first += 1;
            }else{
                AA[P(B,-A)].second += 1;
            }
    }
    for(auto p:AA){
        ans = (ans * (mpow(2,AA[p.first].first) + mpow(2,AA[p.first].second) - 1)%M)%M;
    }
    ans = (ans + M  + zeros -1)%M;
    cout << ans << endl;
    
}




Measured memory_bytes: 19052
import sys, random, math
from bisect import bisect_left, bisect_right
input = sys.stdin.readline

def main():
    inf = 10 ** 20

#    t = int(input())
#    t, a, b = map(int, input().split())
    t = 1
    
    for _ in range(1, t+1):
    #    print("Case #{}: ".format(_), end = '')
        
        a, b, h, m = map(int, input().split())
        
        a_a = ((h*60+m)/720) * 2 * math.pi
        b_a = (m / 60) * 2 * math.pi
        
        diff = abs(a_a - b_a)
        if(diff > math.pi):
            diff = 2*math.pi - diff
        
        ans = a*a+b*b-2*a*b*math.cos(diff)
        print(ans**0.5)
        
        
main()

Measured memory_bytes: 77108
#include <bits/stdc++.h>
using namespace std;
#define LOCAL
#pragma region Macros
typedef long long ll;
#define ALL(x) (x).begin(),(x).end()
const long long MOD=1e9+7;
// const long long MOD=998244353;
const int INF=1e9;
const long long IINF=1e18;
const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
const char dir[4]={'D','R','U','L'};

template<typename T>
istream &operator>>(istream &is,vector<T> &v){
    for (T &x:v) is >> x;
    return is;
}
template<typename T>
ostream &operator<<(ostream &os,const vector<T> &v){
    for (int i=0;i<v.size();++i){
        os << v[i] << (i+1==v.size()?"": " ");
    }
    return os;
}
template<typename T,typename U>
ostream &operator<<(ostream &os,const pair<T,U> &p){
    os << '(' << p.first << ',' << p.second << ')';
    return os;
}
template<typename T,typename U>
ostream &operator<<(ostream &os,const map<T,U> &m){
    os << '{';
    for (auto itr=m.begin();itr!=m.end();++itr){
        os << '(' << itr->first << ',' << itr->second << ')';
        if (++itr!=m.end()) os << ',';
        --itr;
    }
    os << '}';
    return os;
}
template<typename T>
ostream &operator<<(ostream &os,const set<T> &s){
    os << '{';
    for (auto itr=s.begin();itr!=s.end();++itr){
        os << *itr;
        if (++itr!=s.end()) os << ',';
        --itr;
    }
    os << '}';
    return os;
}

void debug_out(){cerr << '\n';}
template<class Head,class... Tail>
void debug_out(Head&& head,Tail&&... tail){
    cerr << head;
    if (sizeof...(Tail)>0) cerr << ", ";
    debug_out(move(tail)...);
}
#ifdef LOCAL
#define debug(...) cerr << " ";\
cerr << #__VA_ARGS__ << " :[" << __LINE__ << ":" << __FUNCTION__ << "]" << '\n';\
cerr << " ";\
debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

template<typename T> T gcd(T x,T y){return y!=0?gcd(y,x%y):x;}
template<typename T> T lcm(T x,T y){return x/gcd(x,y)*y;}

template<class T1,class T2> inline bool chmin(T1 &a,T2 b){
    if (a>b){a=b; return true;} return false;
}
template<class T1,class T2> inline bool chmax(T1 &a,T2 b){
    if (a<b){a=b; return true;} return false;
}
#pragma endregion

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S,T; cin >> S >> T;
    int n=S.size(),m=T.size();
    int ans=INF;
    for (int i=0;i+m-1<n;++i){
        string U=S.substr(i,m);
        int cnt=0;
        for (int j=0;j<m;++j) cnt+=(T[j]!=U[j]);
        chmin(ans,cnt);
    }

    cout << ans << '\n';
}

Measured memory_bytes: 3660
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};
int dx9[9]={0,1,0,-1,1,-1,1,0,-1};
int dy9[9]={0,1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;
typedef pair<ll, ll> PLL;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;
// << fixed << setprecision
// --------------------------------------
ll t1, t2, a1, a2, b1, b2;

ll solve() {
  cin >> t1 >> t2 >> a1 >> a2 >> b1 >> b2;

  ll s1 = t1 * (a1 - b1);
  ll s2 = t2 * (a2 - b2);

  ll p1 = s1, p2 = p1 + s2;
  ll ans = 0;
  if(p2 == 0) {
    ans = LLINF;
  } else if(p1 > 0 && p2 < 0) {
    ans++;
    ans += (s1 / abs(p2)) * 2;
    if(s1 / abs(p2) > 0 && s1 % abs(p2)  == 0) ans--;
  } else if(p1 < 0 && p2 > 0) {
    ans++;
    ans += (abs(s1) / p2) * 2;
    if(abs(s1) / p2 > 0 &&  abs(s1) % p2 == 0) ans--;
  }
  return ans;
}

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

  ll ans = solve();
  if(ans == LLINF) cout << "infinity" << endl;
  else cout << ans << endl;;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define INF_LL 1LL << 40
#define INF 2000000000
#define MOD 1000000007
#define ll long long
#define all(x) x.begin(), x.end()
#define REP(i, a, b) for(int i = a; i < b; i++)
#define rep(i, n) REP(i, 0, n)
// typedef float double;
// typedef priority_queue prique;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<ll> vl;
typedef vector<vi> matrix;
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
int sign[2] = {1, -1};
template <class T> bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
struct edge {
    int to, cost;
};

signed main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int ans = 0;
    rep(i, 10) rep(j, 10) rep(k, 10) {
        int p = 0;
        while(p < n && s[p] - '0' != i)
            p++;
        p++;
        while(p < n && s[p] - '0' != j)
            p++;
        p++;
        while(p < n && s[p] - '0' != k)
            p++;
        if(p < n)
            ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python
from __future__ import division, print_function
from sys import stdin, exit
from operator import add, sub, mul, truediv


def div(a, b):
    return int(truediv(a, b))


class Parser(list):
    """
    <statement> ::= <expression> "="
    <expression> ::= <term> [ ("+"|"-") <term> ]
    <term> ::= <factor> [ ("*"|"/") <factor> ]
    <factor> ::= <number> | "(" <expression> ")"
    """

    def __init__(self, tokens):
        self._iter_tokens = iter(tokens)

        self._next_symbol()
        while self.symbol != '=':
            self._expression()

    def _expression(self, fn_table={'+': add, '-': sub}):
        if self.symbol in fn_table:
            op_sign = self.symbol
            self._next_symbol()
            self._term()
            self.append(fn_table[op_sign])
        else:
            self._term()

        while self.symbol in fn_table:
            op_sign = self.symbol
            self._next_symbol()
            self._term()
            self.append(fn_table[op_sign])

    def _term(self, fn_table={'*': mul, '/': div}):
        self._factor()
        while self.symbol in fn_table:
            op_sign = self.symbol
            self._next_symbol()
            self._factor()
            self.append(fn_table[op_sign])

    def _factor(self):
        if self.symbol.isdigit():
            self.append(int(self.symbol))
            self._next_symbol()
        elif self.symbol == '(':
            self._next_symbol()
            self._expression()
            if self.symbol != ')':
                raise SyntaxError(self.symbol)
            self._next_symbol()
        else:
            raise SyntaxError(self.symbol)

    def _next_symbol(self):
        self.symbol = next(self._iter_tokens)


def tokenize(line):
    buf = []
    tokens = []

    for c in line:
        if c.isdigit():
            buf.append(c)
        else:
            if buf:
                tokens.append(''.join(buf))
                del buf[:]
            tokens.append(c)
            if c == '=':
                return tokens


def run(commands):
    stack = []

    for cmd in commands:
        if isinstance(cmd, int):
            stack.append(cmd)
        else:
            buf = stack.pop()
            stack[-1] = cmd(stack[-1], buf)
    return stack[-1]


def main(readline=stdin.readline):
    for _ in range(int(readline())):
        print(run(Parser(tokenize(readline()))))
    exit()


if __name__ == '__main__':
    main()

Measured memory_bytes: 4492
#include<bits/stdc++.h>
#define int long long
using namespace std;
using P=pair<int,int>;
signed main(){
  int H,W;
  cin>>H>>W;
  set<P> s;
  multiset<int> ans;
  for(int i=0;i<W;i++){
    s.insert({i,i}); 
    ans.insert(0);
  }
  int n=0;
  for(int i=0;i<H;i++){
    int a,b;
    cin>>a>>b;
    a--;
    int mx=-1;
    auto it=s.lower_bound({max(a,n),0});
    for(;it!=s.end() && (*it).first<=b;it=s.erase(it)){
      mx=max(mx,(*it).second);
      ans.erase(ans.find((*it).first-(*it).second));
    }
    if(b!=W){
      if(mx!=-1){
        s.insert({b,mx});
        ans.insert(b-mx);
      }
    }
    home:;
    printf("%d\n",ans.size()==0?-1:*ans.begin()+i+1);
    if(n>=a)n=max(n,b);
  }
}

Measured memory_bytes: 25604
#include <iostream>
#include <iomanip>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define POWER9 1000000000
#define MOD POWER9+7
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483647
#define INT_MAX 2147483647
#define LL_MIN (LL)-9223372036854775807
#define LL_MAX (LL)9223372036854775807
#define PI 3.14159265359

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(9);
    
    double T,X;
    cin >> T >> X;
    cout << T/X << endl;

    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("-O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include<cmath>
#include<cstdio>
#include<algorithm>
#include<bitset>
#include<complex>
#include<deque>
#include<fstream>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<utility>
#include<valarray>
#include<vector>
#include<array>
#include<forward_list>
#include<random>
#include<ratio>
#include<tuple>
#include<unordered_map>
#include<unordered_set>
#include<cstring>

using namespace std;
using Int = long long; using uint = unsigned int; using uInt = unsigned long long;
typedef pair<int,int> Pi; typedef pair<Int,Int> Pl;
constexpr int mod = 1e9+7;
constexpr int INF32 = numeric_limits<int>::max();
constexpr Int INF64 = numeric_limits<Int>::max();
#define END {cout<<ans<<'\n'; return 0;}
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
#define mp make_pair
#define Pr(t) priority_queue<t>
#define gPr(t) priority_queue<t,vector<t>,greater<t>>
#define V(t) vector<t>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define rer(i,l,r) for(int i=(l); i<=(r); ++i)
#define gnr(i,l,r) for(int i=(r); i>=(l); --i)
#define eb emplace_back
#define pri1(a) cout<<(a)<<'\n'
#define pri2(a,n) {rep(i,n-1)cout<<a[i]<<' '; if(n)cout<<a[n-1]<<'\n';}
#define prip(p) cout<<p.fi<<' '<<p.se<<'\n'
#define priend(a) {cout<<(a)<<'\n'; return 0;}
#define fil(a,v) memset((a),v,sizeof(a))
template<class T> inline bool cmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool cmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int n,m,_,x,y,q;
string s,sb;
bool ok;
char cf,cb;

int dp1[3002][3001],dp2[3002][3001];
int main(){
  cin.tie(nullptr); ios::sync_with_stdio(0);
  //cout<<fixed<<setprecision(20);

  cin>>n>>m; int w[n],v[n]; rep(i,n)cin>>w[i]>>v[i];
  rer(i,1,n){
    rer(j,1,m-1){
      if(j>=w[i-1])cmax(dp1[i][j],dp1[i-1][j-w[i-1]]+v[i-1]);
      cmax(dp1[i][j],dp1[i-1][j]);
    }
  }
  gnr(i,1,n){
    rer(j,1,m-1){
      if(j>=w[i-1])cmax(dp2[i][j],dp2[i+1][j-w[i-1]]+v[i-1]);
      cmax(dp2[i][j],dp2[i+1][j]);
    }
  }
  int ans=0;
  rer(i,1,n){
    rep(j,m){
      cmax(ans,dp1[i-1][j]+dp2[i+1][m-1-j]+v[i-1]);
    }
  }
  END
}

Measured memory_bytes: 70656
#include<stdio.h>
#define N 100
#define INF 10000000
#define WHITE 0
#define BRACK 1

int n, Color[N], A[N][N], B[N], C[N];

void prim()
{
  int i, j, m;

  for(i=0; i<n; i++){
    B[i] = INF;
    C[i] = -1;
    Color[i] = WHITE;
  }
  B[0] = 0;
  while(1){
    m = INF;
    for(i=0; i<n; i++){
      if(Color[i] != BRACK && B[i] < m){
    m = B[i];
    j = i;
      }
    }
    if(m == INF) break;
    Color[j] = BRACK;
    for(i=0; i<n; i++){
      if(Color[i] !=BRACK && A[j][i] < B[i] && A[j][i]>=0){
    C[i] =j;
    B[i] = A[j][i];
      }
    }
  }
}
int main()
{
  int i,j,co=0;
  scanf("%d",&n);
  for(i=0; i<n; i++){
    for(j=0; j<n; j++){
      scanf("%d",&A[i][j]);
    }
  }
  prim();
  for(i=0; i<n; i++)     co+=B[i];
  printf("%d\n",co);
  return 0;
}



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

int main(void) {
    long long ans = 0;
    string s;
    cin >> s;
    for (int bit = 0; bit < (1 << (s.size() - 1)); bit++) {
        long long temp = 0;
        for (int i = 0; i < s.size(); i++) {
            temp = temp * 10 + s[i] - '0';
            if (i == s.size() - 1 || bit >> i & 1) {
                ans += temp;
                temp = 0;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <bitset>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <math.h>

using namespace std;

int main (){
    double A, B;
    cin >> A >> B;

    double tax8 = 0.08;
    double tax10 = 0.1;

    double tax8_start = A/tax8;
    double tax8_end   = (A+1)/tax8;
    double tax10_start = B/tax10;
    double tax10_end   = (B+1)/tax10;

    int tax8_start_mod;
    tax8_start_mod = tax8_start;
    if (tax8_start_mod == tax8_start ) {
        int i = 0;
    } else {
        tax8_start_mod = tax8_start_mod + 1; 
    }
    int tax10_start_mod = tax10_start;
    if (tax10_start_mod == tax10_start ) {
        int i = 0;
    } else {
        tax10_start_mod = tax10_start_mod + 1; 
    }

    int tax8_end_mod = tax8_end;
    int tax10_end_mod = tax10_end;

    if (tax8_end_mod == tax8_end ) {
          tax8_end_mod = tax8_end_mod - 1; 
    }

    if (tax10_end_mod == tax10_end ) {
        tax10_end_mod = tax10_end_mod - 1; 
    }

    int ans = -1;
    if((tax8_start_mod <= tax10_start_mod) && (tax10_start_mod <= tax8_end_mod) ){
        ans = tax10_start_mod;
    } else if ((tax10_start_mod <= tax8_start_mod) && (tax8_start_mod <= tax10_end_mod)){
        ans = tax8_start_mod;
    }

    cout << ans << endl;

}

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 1e5 + 5;

pair<ll, int> pp[MAXN];

ll ans[MAXN];

void solve(){
	int n;
	scanf("%d", &n);
	REPN(i, 1, n){
		scanf("%lld", &pp[i]._1);
		pp[i]._2 = i;
	}
	sort(pp, pp + n + 1);
	reverse(pp, pp + n + 1);
	int mn = n + 1;
	for(int i = 0; i < n; ){
		int j;
		for(j = i; pp[j]._1 == pp[i]._1; j++){
			mn = min(mn, pp[j]._2);
		}
		ans[mn] += (pp[i]._1 - pp[j]._1) * j;
		//printf("%d %lld\n", mn, ans[mn]);
		i = j;
	}
	REPN(i, 1, n){
		printf("%lld\n", ans[i]);
	}
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


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

int W,H,N;
vector<pair<int,int>>a;

main(){
	cin>>W>>H>>N;
	for(int i=1;i<=N;++i){
		int x1,y1,x2,y2;
		scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
		if(x1==0|x1==W|y1==0|y1==H && x2==0|x2==W|y2==0|y2==H){
			for(int j=0;j<2;++j){
				if(y1==0){
					a.push_back({x1,i});
				}else if(x1==W){
					a.push_back({W+y1,i});
				}else if(y1==H){
					a.push_back({W+H+W-x1,i});
				}else if(x1==0){
					a.push_back({W+H+W+H-y1,i});
				}
				x1=x2;
				y1=y2;
			}
		}
	}
	sort(a.begin(),a.end());
	int s[100000],i=0;
	bool d[100001]={false};
	for(auto b:a){
		int j=b.second;
		if(d[j]){
			if(s[--i]!=j){
				cout<<"NO";
				return 0;
			}
		}else{
			d[j]=true;
			s[i++]=j;
		}
	}
	cout<<"YES";
}


Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = 1; i < (int)(n+1); i++)
int main(){
   int N;
   cin>>N;
   int ans=0;
   vector<int>A(N);
   vector<int>B(8);
   int S=0;
   rep(i,8){
       B[i]=0;
   }
   rep(i,N){
       cin>>A[i];
       if(3200<=A[i]){
           S++;
       }
       else{
           B[A[i]/400]++;
       }
   }
    rep(i,8){
        if(B[i]!=0){
            ans++;
        }
    }
    cout<<max(ans,1)<<" "<<ans+S<<endl;
}


Measured memory_bytes: 3604