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

#define NL '\n'
#define xx first
#define yy second
#define eps 1e-9
#define ins insert
#define pb push_back
#define mp make_pair
#define ll long long
#define sz(x) x.size()
#define pi 2.0*acos(0.0)
#define sqr(x) ((x) * 1ll * (x))
#define all(x) (x).begin(),(x).end()
#define FIN freopen("input.txt", "r", stdin);
#define FOUT freopen("output.txt", "w", stdout);
#define rep(ii,aa,bb) for(int (ii)=int(aa);(ii)<(int)(bb);++(ii))
#define per(ii,aa,bb) for(int (ii)=int(aa)-1;(ii)>=(int)(bb);--(ii))
#define _fastIO() ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0)

ll bigMod(ll N,ll P,ll M){
	//used for calculating: N^P % M
	if(P==0) return 1;
	if(P%2==0){
		ll ret=bigMod(N,P/2,M);
		return ((ret%M)*(ret%M))%M;
	}
	else return ((N%M)*(bigMod(N,P-1,M)%M))%M;
}

bool status[10000001];
void sieve(void){
  int n = sqrt(1000001);
  for(int i=3; i<=n; i+=2){
    if(status[i]==0){
      for(int j=i*i; j<1000001; j += i+i){
        status[j] = 1;
      }
    }
  }
}

int main(){
    _fastIO();
    int a,b;
    cin >> a >> b;
    if(a == 1){
        if(b == 1){
            cout << "Draw";
        }
        else cout << "Alice";
        return 0;
    }
    if(b == 1){
        if(a == 1){
            cout << "Draw";
        }
        else cout << "Bob";
        return 0;
    }

    if(a > b) cout << "Alice";
    else if ( b > a ) cout << "Bob";
    else cout << "Draw";

}


Measured memory_bytes: 256
#include <iomanip>
#include <iostream>

using namespace std;
// clang-format off
using i64 = int64_t;
using i32 = int32_t;
#define all(x) x.begin(), x.end()
// #define int i64
template <class T, typename U> constexpr inline bool exist(const T &s, const U &e) { return s.find(e) != s.end(); }
template <class T> constexpr inline i32 SZ(const T &x) { return x.size(); }
template <class T> constexpr inline bool rmn(T &a, T b) { return a > b ? (a = b, true) : false; }
template <class T> constexpr inline bool rmx(T &a, T b) { return a < b ? (a = b, true) : false; }
const char el = '\n'; const i32 MOD = 1e9 + 7, INF = 0x3f3f3f3f; const i64 INFLL = ((i64)INF << 32) | INF;

#ifdef LOCAL // debugging swiss knife
template <typename Ostream, typename Cont> enable_if_t<is_same<Ostream, ostream>::value, Ostream &> operator<<(Ostream &os, const Cont &v) { os << "{"; for (const auto &x : v) os << x << ", "; return os << "}"; }
template <typename Ostream, typename... Ts> Ostream &operator<<(Ostream &os, const pair<Ts...> &p) { return os << "(" << p.first << ", " << p.second << ")"; }
template <class... Args> void dbg_out(Args... args) { ((std::cerr << "\033[32m" << args << "\033[37m, "), ...); }
#define dbg(...) cerr << "\033[1;31m" << __LINE__ << ": [" << #__VA_ARGS__ << "]\033[37m  = ", dbg_out(__VA_ARGS__), cerr << "\033[0m" << endl;
#else
#define dbg(...) ;
#endif
// clang-format on
////////////////////////////////// TEMPLATE ENDS /////////////////////////////////
// Original author: Burunduk1; Optimizations by madhur4127
// Works only on Linux based systems. NOT on CodeForces.
// See FastIO.hpp for usage
#include <sys/stat.h>
#include <sys/mman.h>
#include <unistd.h>
static struct input {
    struct stat ip_stat;
    char *ptr;
    int pos, len;
    input() {
        fstat(0, &ip_stat);
        pos = 0, len = ip_stat.st_size, ptr = (char *)mmap(NULL, len, PROT_READ, MAP_PRIVATE, 0, 0);
    }
} ip;
char getChar() {
    // assert(ip.pos < ip.len);
    return ip.ptr[ip.pos++];
}
template <typename T = int> inline T read() {
    char s = 1, c = read<char>();
    T x = 0;
    if (c == '-') s = -1, c = getChar();
    while ('0' <= c && c <= '9')
        x = x * 10 + c - '0', c = getChar();
    return s == 1 ? x : -x;
}
template <> inline char read<char>() {
    char c = getChar();
    while (c <= 32)
        c = getChar();
    return c;
}

int32_t main() {
    ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
    cout << fixed << setprecision(13), cerr << fixed << setprecision(3);

    i64 n = read();
    i64 ans = n * (n + 1) / 2;
    for (i64 i = 1; i < n; ++i) {
        ans += i * (i + 1) / 2;
        i64 l = read(), r = read();
        if (l > r) swap(l, r);
        ans -= l * (n + 1 - r);
    }
    cout << ans << el;

    return 0;
}

#undef int

Measured memory_bytes: 6224
// B.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>

using namespace std;

int main(int argc, char *argv[]) {
	int n, x;
	cin >> n >> x;
	vector<int> l(n + 1);
	for (int i = 0; i < n; ++i) {
		int a;
		cin >> a;
		l[i + 1] = l[i] + a;
	}
	int ans = 0;
	for (int i = 0; i <= n; ++i) {
		ans += l[i] <= x;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
    int x[11];
    int r, d;
    cin >> r >> d >> x[0];
    for (int i = 1; i < 11; i++)
    {
        x[i] = r * x[i - 1] - d;
    }
    for (int i = 1; i < 11; i++)
    {
        cout << x[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define pii pair<int,int>
#define vi  vector<int>
#define vii vector<pair<int,int>>
#define vll vector<lli>
#define pb  push_back
#define mp  make_pair
#define ss  second
#define ff  first
#define all(x) x.begin(),x.end()
void solve()
{
    int n;cin>>n;
    if(n%1000!=0)cout<<1000-n%1000<<endl;
    else cout<<0<<endl;
}
int main()
{
    solve();
}





Measured memory_bytes: 3588
import math
A, B = input().split()
A = float(A)
B = float(B)

cand_a = math.ceil(12.5*A)
cand_b = math.ceil(10*B)
max_a = math.floor(12.5*(A + 1))
max_b = math.floor(10*(B + 1))

if cand_a > cand_b:
    if cand_a < max_b:
        ans = cand_a
    else:
        ans = -1
elif cand_b > cand_a:
    if cand_b < max_a:
        ans = cand_b
    else:
        ans = -1
else:
    ans = cand_a

print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define at(x,i) get<i>(x);
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
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;
}
int main(){
    ll n,k;cin >> n >>k;
    vl v(n);
    rep(i,n)cin >> v[i];
    ll p=v[0];
    ll cnt=0;
    while(p%2==0){
        p/=2;
        cnt++;
    }
    ll s=pow(2,cnt);
    bool check=false;
    rep(i,n){
        if(v[i]%s!=0)check=true;
        v[i]/=s;
        if(v[i]%2==0)check=true;
    }
    if(check){
        cout << 0 <<endl;
        return 0;
    }
    ll x=v[0];
    rep(i,n){
        x=x/__gcd(x,v[i])*v[i];
    }
    x*=s/2;
    ll ans=k/x;
    ans=(ans+1)/2;
    cout << ans <<endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>

using namespace std;

int main()
{
	char a, b;
	string A, B;
	cin >> a >> b;
	
	for (int count = 0; count < b - '0'; count++)
	{
		A.push_back(a);
	}
	for (int count = 0; count < a - '0'; count++)
	{
		B.push_back(b);
	}
	if (A > B)
	{
		cout << B << endl;
	}
	else
	{
		cout << A << endl;
	}
}

Measured memory_bytes: 256
n,m = gets.split.map &:to_i
$node = Array.new(n){ [] }
m.times do
  a,b = gets.split.map(&:to_i)
  $node[a-1] << b - 1
  $node[b-1] << a - 1
end

link = Array.new(n){ nil }

def bfs(link)
  q = [0]
  while !q.empty?
    visit = q.shift
    $node[visit].each do |next_node|
      next unless link[next_node].nil?
      link[next_node] = visit
      q.push next_node 
    end
  end
end

bfs(link)
link.shift

if link.any? &:nil?
  puts 'No'
else
  puts 'Yes'
  link.each do |v|
    puts v + 1
  end
end




Measured memory_bytes: 32968
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;

struct SCC{
  int n;
  vector<vector<int> > G,rG,T,C;
  vector<int> vs,used,belong;
  SCC(){}
  SCC(int sz):n(sz),G(sz),rG(sz),used(sz),belong(sz){}
  
  void add_edge(int from,int to){
    G[from].push_back(to);
    rG[to].push_back(from);
  }
  
  void input(int m,int offset=0){
    int a,b;
    for(int i=0;i<m;i++){
      cin>>a>>b;
      add_edge(a+offset,b+offset);
    }
  }
  
  void dfs(int v){
    used[v]=1;
    for(int i=0;i<(int)G[v].size();i++){
      if(!used[G[v][i]]) dfs(G[v][i]);
    }
    vs.push_back(v);
  }
  
  void rdfs(int v,int k){
    used[v]=1;
    belong[v]=k;
    C[k].push_back(v);
    for(int i=0;i<(int)rG[v].size();i++){
      if(!used[rG[v][i]]) rdfs(rG[v][i],k);
    }
  }
  
  int build(){
    fill(used.begin(),used.end(),0);
    vs.clear();
    for(int v=0;v<n;v++){
      if(!used[v]) dfs(v);
    }
    fill(used.begin(),used.end(),0);
    int k=0;
    for(int i=vs.size()-1;i>=0;i--){
      if(!used[vs[i]]){
	T.push_back(vector<int>());
	C.push_back(vector<int>());
	rdfs(vs[i],k++);
      }
    }
    for(int i=0;i<n;i++)
      for(int u:G[i])
	if(belong[i]!=belong[u])
	  T[belong[i]].push_back(belong[u]);
    for(int i=0;i<k;i++){
      sort(T[i].begin(),T[i].end());
      T[i].erase(unique(T[i].begin(),T[i].end()),T[i].end());
    }
    return k;
  }
};


int diff(int a, int b){//time difference
  int ret=abs(a-b);
  return min(ret, 24-ret);
}

int main(void) {
  int i,j;
  int n;
  cin>>n;

  vi a(n);
  rep(i,n)cin>>a[i];
  a.push_back(0);
  n++;

  for(int ans=12;ans>=0;ans--){

    SCC scc((n+1)*2);//1-indexed

    rep(i,n) rep(j,n){
      if(i==j) continue;
      if(diff(a[i], a[j]) < ans){
	scc.add_edge(n+(i+1), n-(j+1));
	scc.add_edge(n-(i+1), n+(j+1));
      }
      if(diff(a[i], 24-a[j]) < ans){
	scc.add_edge(n-(i+1), n-(j+1));
	scc.add_edge(n+(i+1), n+(j+1));
      }
    }

    scc.build();

    bool c=true;

    auto belong=scc.belong;
    for(int i=0;i<n;i++){
      if(belong[n-(i+1)]==belong[n+(i+1)]){
	c=false;
      }
    }
    if(c){
      cout<<ans<<endl;
      return 0;
    }

  }

}



Measured memory_bytes: 384
def main():
    N, Z, W = map(int, input().split())
    A = list(map(int, input().split()))

    if N == 1:
        print(abs(W - A[0]))
        return

    D = [0]*N
    E = [0]*N
    D[0] = abs(Z-W)
    D[1] = abs(A[N-1]-A[N-2])
    E[0] = abs(Z-W)
    E[1] = abs(A[N-2] - A[N-1])

    for n in range(2, N):
        D[n] = min(E[n-1], D[n-1])
        E[n] = max(D[n-1], E[n-1])

    # print(D)
    # print(E)
    # print(D[N-1])

    res = max(E[N-1], abs(W - A[N-1]))
    print(res)

if __name__ == "__main__":
    main()


Measured memory_bytes: 3188
#include <functional>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <iomanip>
#include <vector>
#include <string>
#include <cstdio>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <set>
#if __cplusplus >= 201103L
#include <unordered_map>
#include <unordered_set>
#endif
#define ls x<<1
#define rs x<<1|1
#define fi first
#define se second
#define ll long long
#define pb push_back
#define mp make_pair
#define fun function
#define vi vector<int>
#define lowbit(x) x&(-x)
#define pii pair<int,int>
#define all(x) x.begin(),x.end()
#define mem(a,b) memset(a,b,sizeof(a))
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);

using namespace std;

const int INF = 0x3f3f3f3f;


int main() {
	IOS;
#ifdef xiaofan
	freopen("1.in","r",stdin);
	freopen("1.out","w",stdout);
#endif

	string s;
	cin>>s;
	if(s=="AAA"||s=="BBB")
		cout<<"No"<<endl;
	else
		cout<<"Yes"<<endl; 




	return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
#include<stdlib.h>
using namespace std;
#define PI 3.14159265358979
typedef  long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#include<set>
//---------------------------------------------
 

int main(void)
{
    float l;

    cin>>l;
    cout<<fixed;

    cout<<setprecision(9)<<pow((l/3),3)<<endl;


}

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

int main(){
	ll W, H, x, y;
	cin >> W >> H >> x >> y;

	double ans = 0.5*W*H;
	int c = W==2*x && H==2*y;
	cout << setprecision(10) << ans << " " << c << endl;

return 0;
}


Measured memory_bytes: 3796
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
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 M 1000000007
#define all(a) (a).begin(),(a).end()
#define rep(i,n) reps(i,0,n)
#define reps(i,m,n) for(int i=(m);i<(n);i++)
int main(){
  int n;string s;cin>>n>>s;
  rep(i,s.size()){
    int c=s[i]+n;
    if(c>('Z'))c-=26;
    s[i]=(char)c;
  }
  cout<<s;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
#define SIZE 262144
class segtree
{
public:
	int seg[SIZE * 2];
	void update(int a, int b)
	{
		a += SIZE;
		seg[a] = b;
		for (;;)
		{
			a /= 2;
			if (a == 0)break;
			seg[a] = max(seg[a * 2], seg[a * 2 + 1]);
		}
	}
	int get(int beg, int end, int node, int lb, int ub)
	{
		if (ub < beg || end < lb)return -1000000000;
		if (beg <= lb&&ub <= end)return seg[node];
		return max(get(beg, end, node * 2, lb, (lb + ub) / 2), get(beg, end, node * 2 + 1, (lb + ub) / 2 + 1, ub));
	}
};
class unionfind
{
public:
	int par[SIZE];
	int ran[SIZE];
	int ren[SIZE];
	void init()
	{
		for (int i = 0; i<SIZE; i++)
		{
			par[i] = i;
			ran[i] = 0;
			ren[i] = 1;
		}
	}
	int find(int a)
	{
		if (a == par[a])return a;
		else return par[a] = find(par[a]);
	}
	void unite(int a, int b)
	{
		a = find(a);
		b = find(b);
		if (a == b)return;
		if (ran[a]>ran[b])
		{
			par[b] = a;
			ren[a] += ren[b];
		}
		else
		{
			par[a] = b;
			ren[b] += ren[a];
		}
		if (ran[a] == ran[b])ran[b]++;
	}
};
unionfind uf;
segtree tree1, tree2;
int d[202020];
int main()
{
	int num, kai;
	scanf("%d%d", &num, &kai);
	for (int i = 0; i < num; i++)scanf("%d", &d[i]), tree1.update(i, d[i]), tree2.update(i, -d[i]);
	uf.init();
	for (int i = 0; i < num - kai; i++)if (tree1.get(i, i + kai, 1, 0, SIZE - 1) == d[i + kai] && -tree2.get(i, i + kai, 1, 0, SIZE - 1) == d[i])uf.unite(i, i + 1);
	d[num] = num;
	int c = 0;
	for (int i = num - 1; i >= 0; i--)
	{
		if (d[i + 1] > d[i])c++;
		else c = 1;
		if (c >= kai)uf.unite(num, i);
	}
	int r = 0;
	for (int i = 0; i < num - kai + 1; i++)r += (uf.find(i) == i);
	if (uf.find(num) == num&&uf.ren[num]>1)r++;
	printf("%d\n", r);
}

Measured memory_bytes: 7936
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define ll long long
#define REP(i,a,b) for(int i=(a),_end_=(b);i<=_end_;i++)
#define DREP(i,a,b) for(int i=(a),_end_=(b);i>=_end_;i--)
#define EREP(i,a) for(int i=start[(a)];i;i=e[i].next)
inline int read()
{
	int sum=0,p=1;char ch=getchar();
	while(!(('0'<=ch && ch<='9') || ch=='-'))ch=getchar();
	if(ch=='-')p=-1,ch=getchar();
	while('0'<=ch && ch<='9')sum=sum*10+ch-48,ch=getchar();
	return sum*p;
}

int n;

void init()
{
	n=read();
	int lx=0,ly=0,lt=0;
	REP(i,1,n)
	{
		int t=read(),x=read(),y=read();
		int dis=abs(x-lx)+abs(y-ly);
		if(dis<=(t-lt) && dis%2==(t-lt)%2)
		{
			lt=t;lx=x;ly=y;
		}else
		{
			printf("No\n");
			return;
		}
	}
	printf("Yes\n");
}

int main()
{
	init();
	return 0;
}



Measured memory_bytes: 256
N, M = map(int, raw_input().split())
A = []
A = [0 for i in range(N + 1)]
for i in range(M):
    a = int(raw_input())
    A[a] = -1

dp = []
dp = [0 for i in range(N + 1)]
dp[0] = 1

for i in range(N):
    if (i + 1) <= N and A[i + 1] == 0:
        dp[i + 1] += dp[i]
    if (i + 2) <= N and A[i + 2] == 0:
        dp[i + 2] += dp[i]


print str(dp[N]%1000000007)

Measured memory_bytes: 466172
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef pair<int, int> P;

int main(){
    ios::sync_with_stdio(false), cin.tie(nullptr);
    int N, K, cnt = 0, right = 0, ans = 0; cin >> N >> K;
    string S; cin >> S;
    for(int i=0;i<N;i++){
        while(right<N and (cnt<K or S[right]=='1')){
            if(S[right]=='0'){
                cnt++;
                while(right<N and S[right]=='0') right++;
            }
            else right++;
        }
        ans = max(ans, right-i);

        if(i<N-1 and S[i]=='0' and S[i+1]=='1') cnt--;
    }
    cout << ans << endl;
    return 0;
}

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

int main(void) {
  long long A, B, C, X, Y;
  cin >> A >> B >> C >> X >> Y;

  long long ret = 1e18;
  for (int i = 0; i <= 2*max(X, Y); i++) {
    long long remx = max(0LL, X - (i / 2));
    long long remy = max(0LL, Y - (i / 2));
    ret = min(ret, remx * A + remy * B + C * i);
  }
  cout << ret << endl;
  return 0;
}

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


int main() {
    string s;
    cin >> s;
    int a = s[0]-'0';
    int b = s[1]-'0';
    int c = s[2]-'0';
    int d = s[3]-'0';
    if(a+b+c+d == 7){//+++
        printf("%d+%d+%d+%d=7\n",a,b,c,d);
    }else if(a-b+c+d == 7){//-++
        printf("%d-%d+%d+%d=7\n",a,b,c,d);
    }else if(a-b-c+d == 7){//--+
        printf("%d-%d-%d+%d=7\n",a,b,c,d);
    }else if(a-b-c-d == 7){//---
        printf("%d-%d-%d-%d=7\n",a,b,c,d);
    }else if(a+b+c-d == 7){//++-
        printf("%d+%d+%d-%d=7\n",a,b,c,d);
    }else if(a+b-c-d == 7){//+--
        printf("%d+%d-%d-%d=7\n",a,b,c,d);
    }else if(a-b+c-d == 7){//-+-
        printf("%d-%d+%d-%d=7\n",a,b,c,d);
    }else if(a+b-c+d == 7){//+-+
        printf("%d+%d-%d+%d=7\n",a,b,c,d);
    }    
    return 0;
}

/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 256
mod io{
    use std::io::*;
    pub fn read<T: ::std::str::FromStr>()->T{
        let stdin=stdin();
        let ret=stdin.lock().bytes().map(|c|c.unwrap()as char)
        .skip_while(|c|c.is_whitespace())
        .take_while(|c|!c.is_whitespace())
        .collect::<String>().parse().ok().unwrap();
        ret
    }
}
use io::read;
use std::cmp::*;
fn main(){
    let mut s=0;
    for _ in 0..read::<i32>(){
        s-=read::<i32>()-read::<i32>()-1;
    }
    println!("{}",s)
}


Measured memory_bytes: 4352
N = int(input())
minimum = 10**5
for i in range(1,-(-N//2)+1):
    A = i
    B = N - i
    total = 0
    for _ in range(6):
        total += A % 10 + B % 10
        A //= 10
        B //= 10
    if total < minimum:
        minimum = total
print(minimum)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define endl '\n'
#define eps 1e-6
#define oo 1e7+5

using namespace std;

typedef long long int ll;
typedef unsigned long long ull;
typedef vector<pair<int,pair<int,int>>> dirgraph;
typedef vector<vector<int>> graph;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	int smallerSoFar=INT_MAX;

	int n;
	cin>>n;
	int ans=0;
	while(n--)
	{
		int ai;
		cin>>ai;
		if(ai<=smallerSoFar)
		{
			ans++;
			smallerSoFar=ai;
		}
	}
	cout<<ans<<endl;


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep2(i,n) for (int i = 1; i <= (n); i++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
using ll = long long;
using vi = vector<int>;
template <class T>
using Grid = vector<vector<T>>;

int main(){
    int X, Y;
    cin >> X >> Y;
    cout << X + Y / 2 << endl;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
int main()
{
	int n;
	scanf("%d", &n);

	vector<int> a(n);
	rep(i, n) scanf("%d", &a[i]);
	rep(i, n) a[i]--; //0からスタートするようにする

	vector<int> b(n);
	rep(i, n) scanf("%d", &b[i]);

	vector<int> c(n - 1);
	rep(i, n - 1) scanf("%d", &c[i]);

	int ans = 0;
	// Bの合計
	rep(i, n)
	{
		ans += b[a[i]];
	}
	// Cの合計。
	rep(i, n - 1)
	{
		if (a[i + 1] == a[i] + 1) //料理iを食べた直後に料理i+1を食べると満足度Ciを追加で得ます
		{
			ans += c[a[i]];
		}
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

long long N, M, an;

bool check(long long v)
{
    long long last = M - (N-1) * v;
    return (M % v == 0 && last > 0 && (last % v) == 0);
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> N >> M;
    for (long long i = 1; i*i <= M; ++i) {
        if (check(i)) an = max(an, i);
        if (check(M/i)) an = max(an, M/i);
    }
    cout << an << endl;
    return 0;
}


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

map<int,int> prime_factor(int n){
  map<int,int> ret;
  for(int i = 2; i*i <= n; i++){
    int t = n;
    while(t%i == 0){
      ret[i]++;
      t /= i;
    }
  }
  //if(n != 1) ret[n] = 1; //n=素数
  return ret;
}

signed main(){

  int ans;
  int n,p; cin >> n >> p;
  map<int,int> mp;
  mp = prime_factor(p);
  mp[p] = 1;
  mp[1] = 1e13;


  for(auto p = mp.rbegin(); p != mp.rend(); p++){
    if(p->second >= n){
      cout << p->first << endl;
      return 0;
    }
  }

  return 0;
}


Measured memory_bytes: 384
require 'prime'
n = gets.to_i
pnums = Prime.each(Math::sqrt(n).to_i).to_a
_ = pnums.shift
res = 0
if pnums.size > 2
  pnums.combination(3) do |i, j, k|
    res += 1 if i * j * k <= n
  end
end
if pnums.size > 1
  pnums.combination(2) do |i, j|
    res += 1 if i ** 3 * j <= n
    res += 1 if j ** 3 * i <= n
  end
end

puts res

Measured memory_bytes: 2044
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

/*
bool dp[105][10005];

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

    dp[0][0]=true;
    for(int i=0;i<n;i++){
        for(int j=0;j<=10000;j++){
            if(dp[i][j]){
                dp[i+1][j]=true;
                dp[i+1][j+s[i]]=true;
            }
        }
    }

    for(int i=10000;i>=0;i--){
        if(i%10!=0&&dp[n][i]){
            cout<<i<<endl;
            return 0;
        } 
    }
    cout<<0<<endl;
}
*/

int main(){
    int n; cin>>n;
    vector<int> s(n);
    int sum=0;
    for(int i=0;i<n;i++){
        cin>>s[i];
        sum+=s[i];
    }
    sort(s.begin(),s.end());
    if(sum%10!=0) cout<<sum<<endl;
    else{
        for(int i=0;i<n;i++){
            if(s[i]%10!=0){
                cout<<sum-s[i]<<endl;
                return 0;
            }
        }
        cout<<0<<endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> P;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const ll MOD = 1e9 + 7;

bool comp_abs(int a, int b){
	return abs(a) > abs(b);
}

int main(){
	ll N, K, nax = -inf;
	cin>>N>>K;
	vector<ll> A(N);
	ll ans = 1;
	rep(i,N){cin>>A[i]; nax = max(nax, A[i]);}
	sort(all(A), comp_abs);

	if(nax < 0 && K % 2 == 1){
		sort(all(A), greater<ll>());
		rep(i,K){ans *= A[i]; ans %= MOD;}
		if(ans < 0)ans += MOD;
		cout<<ans<<endl;
		return 0;
	}

	ll cnin = -inf, cnax = -inf;
	rep(i,K){
		if(A[i]>=0){
			if(cnax == -inf){
				cnax = A[i];
			}else{
				ans *= cnax;
				ans %= MOD;
				cnax = A[i];
			}
		}else{
			if(cnin == -inf){
				cnin = A[i];
			}else{
				ans *= cnin;
				ans %= MOD;
				cnin = A[i];
			}
		}
	}
	// cout<<cnin<<' '<<cnax<<endl;
	ll t_ans = ans;
	if(cnin != -inf){t_ans *= cnin; t_ans %= MOD;}
	if(cnax != -inf){t_ans *= cnax; t_ans %= MOD;}
	// cout<<t_ans<<endl;

	if(t_ans < 0 && cnin != -inf && N != K){
		if(N == K+1){
			ll t = A[K];
			ans *= t; ans %= MOD;
			if(t < 0){
				ans *= cnin; ans %= MOD;
			}else{
				ans *= cnax; ans %= MOD;
			}
		}else{
			ll nxt_nin = -inf, nxt_nax = -inf;
			for(ll i = K; i<N; ++i){
				if(nxt_nin == -inf && A[i] < 0)nxt_nin = A[i];
				if(nxt_nax == -inf && A[i] >= 0)nxt_nax = A[i];
			}
			if(cnax == -inf && nxt_nax != -inf){
				ans *= nxt_nax; ans %= MOD;
			}else if(nxt_nax == -inf){
				ans *= nxt_nin; ans %= MOD;
				ans *= cnin; ans %= MOD;
			}else if(nxt_nin == -inf){
				ans *= nxt_nax; ans %= MOD;
				ans *= cnax; ans %= MOD;
			}else{
				ans *= (max(nxt_nin*cnin, nxt_nax*cnax)%MOD);
				ans %= MOD;
			}
		}
	}else{
		ans = t_ans;
	}
	if(ans < 0)ans += MOD;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4856
#include <iostream>

using namespace std;

long long a, b, x, ans;

long long calc(long long n){
  	if(n == -1) return 0;
  	else return n / x + 1;
}

int main(){
	cin >> a >> b >> x;
	ans = calc(b) - calc(a - 1);
	cout << ans << endl;
}

Measured memory_bytes: 256
from heapq import *
from collections import *

N, M = map(int, input().split())
L, R, C = [0] * M, [0] * M, [0] * M

for i in range(M):
    L[i], R[i], C[i] = map(int, input().split())
    L[i] -= 1
    R[i] -= 1

start = defaultdict(lambda: [])
end = defaultdict(lambda: [])
for i in range(M):
    start[L[i]].append(i)
    end[R[i]].append(i)

state = []
for i in start[0]:
    heappush(state, (C[i], i))

for i in range(1, N):
    while len(state) > 0 and R[state[0][1]] < i:
        heappop(state)

    if len(state) == 0:
        print(-1)
        exit()

    for j in start[i]:
        heappush(state, (state[0][0] + C[j], j))

print(state[0][0])


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

using namespace std;

int main()
{
    long k, n;
    cin >> k >> n;

    long m = 0;
    long tmpv[200050] = {0};
    cin >> tmpv[0];

    int i = 0;
    for (i = 1; i < n; ++i)
    {
        cin >> tmpv[i];
        m = max(m, tmpv[i] - tmpv[i - 1]);
    }

    m = max(m, k - tmpv[i-1] + tmpv[0]);

    cout << k - m << endl;

    return 0;
}


Measured memory_bytes: 1792
N = int(input())
ans = [2]
N -= 1

def is_prime(n):
    i = 2
    prime = True
    while i * i <= n:
        if n % i == 0:
            prime = False
            break
        i += 1
    return prime

next_val = 3
for _ in range(N):
    while not is_prime(next_val):
        next_val += 5
    ans.append(next_val)
    next_val += 5

print(*ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  string A,B,C;
  cin >> A >> B >> C;
  if(A[A.length()-1]==B[0] && B[B.length()-1]==C[0]){
    cout << "YES" << endl;
  }
  else{
  cout << "NO" << endl;
  }
}

  
  
  
  

  



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

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef long double ld;
typedef vector<ld> vd;
typedef bool bl;
typedef vector<bl> vb;
typedef unordered_map<ll,unordered_map<ll,ll>> graph;

const ll e5 = 1 << 20;
const ll mod = 998244353;
const ll e3 = 1 << 13;
const ll INF = 1ll << 60;

ll n;
graph t;
ll d,p;

void dfs(ll x,ll pre,ll c){
  // cerr << x << " " << pre << " " << c << endl;
  if(d < c){
    d = c;
    p = x;
  }
  for(auto y : t[x]){
    if(y.first == pre) continue;
    dfs(y.first,x,c+1);
  }
}

int main(){
  cin >> n;
  for(ll i = 0;i < n-1;i++){
    ll a,b;
    cin >> a >> b;
    t[a][b] = 1;
    t[b][a] = 1;
  }
  d = -1;
  dfs(n,0,0);
  cerr << p << " " << d << endl;
  d = -1;
  dfs(p,0,0);
  cerr << p << " " << d << endl;
  d = -1;
  dfs(p,0,0);
  cerr << p << " " << d << endl;
  if(d == 0) cout << "First" << endl;
  else if(d%3 == 1) cout << "Second" << endl;
  else cout << "First" << endl;


}


Measured memory_bytes: 49096
#include <bits/stdc++.h>
#define int long long
using namespace std;
int cal(int a,int b,int t,int A){
	for(int i=0 ; i<114514 ; i+=2){

		b -= min( A , a );
		a -= b/2 + b%2 ;

		if( b<1 )return i+t ;
	}
	return 1e17;
}
signed main(){
	int a,b;
	cin>> a >> b ;
	cout<< min( cal(a*2,b*2,0,a) , cal(b*2-a,a*2,1,b) ) <<endl;
}


Measured memory_bytes: 3136
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author mikit
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        LightScanner in = new LightScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BAtCoderAlloy solver = new BAtCoderAlloy();
        solver.solve(1, in, out);
        out.close();
    }

    static class BAtCoderAlloy {
        public void solve(int testNumber, LightScanner in, PrintWriter out) {
            int n = in.ints();
            long h = in.longs(), w = in.longs();
            int ans = 0;
            for (int i = 0; i < n; i++) {
                long a = in.longs(), b = in.longs();
                if (a >= h && b >= w) {
                    ans++;
                }
            }
            out.println(ans);
        }

    }

    static class LightScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public LightScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        public String string() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new UncheckedIOException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int ints() {
            return Integer.parseInt(string());
        }

        public long longs() {
            return Long.parseLong(string());
        }

    }
}



Measured memory_bytes: 22100
#include<bits/stdc++.h>
using namespace std;
const int N =20;
int A[N],x[N][N],y[N][N];

int counter(int x)
{
    if(x == 0)
        return 0;
    return counter(x >> 1) + (x & 1);
}

int main()
{
    int n;
    while(~scanf("%d",&n))
    {
        for(int i=0; i<n; i++)
        {
            scanf("%d",&A[i]);
            for(int j=0; j<A[i]; j++)
            {
                scanf("%d%d",&x[i][j],&y[i][j]);
            }
        }
        int ans =0;
        for(int bits=1; bits<(1<<n); bits++)
        {
            bool ok =true;
            for(int i=0; i<n; i++)
            {
                if(!(bits&(1<<i)))
                    continue;
                for(int j=0; j<A[i]; j++)
                {
                    if(((bits >> (x[i][j]-1)) & 1) ^ y[i][j])
                        ok = false;
                }
            }

            if(ok)
            {
                ans =max(ans,counter(bits));
            }
        }
        printf("%d\n",ans);
    }
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python

def main():
    s = input()
    acgt = ('A', 'C', 'G', 'T')
    s += 'x'
    max_ = 0
    cnt = 0

    for char in s:
        if char in acgt:
            cnt += 1
        else:
            if cnt > max_:
                max_ = cnt
            cnt = 0

    print(max_)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#![allow(warnings)]
fn read<T: std::str::FromStr>() -> T {
  let mut s = String::new();
  std::io::stdin().read_line(&mut s).ok();
  s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
  read::<String>().split_whitespace()
    .map(|e| e.parse().ok().unwrap()).collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
  (0..n).map(|_| read_vec()).collect()
}

fn main() {
  let s: String = read();

  for ch in 0..s.len() {
    print!("{}", 'x');
  }
  println!();
}

Measured memory_bytes: 4352
#include <map>
#include <string>
#include <iostream>
using namespace std;
int main(){
	map<char,string>m;
	m['T']="a";
	m['L']="i";
	m['U']="u";
	m['R']="e";
	m['D']="o";
	m['1']="";
	m['2']="k";
	m['3']="s";
	m['4']="t";
	m['5']="n";
	m['6']="h";
	m['7']="m";
	m['8']="y";
	m['9']="r";
	m['0']="w";
	string s,t;
	cin>>s;
	for(int i=0;i<s.length();i+=2){
		t=s.substr(i,2);
		if(t=="0U")cout<<"nn";
		else cout<<m[t[0]]<<m[t[1]];
	}
	cout<<endl;
}

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

const int N = 1e5+69;
int h[N];
set<int> adj[N];

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

 int n,m;
 cin >> n >> m;
 for(int i=1; i<=n; i++){
 	cin >> h[i];
 }

 for(int i=1; i<=m; i++){
 	int x,y;
 	cin >> x >> y;
 	adj[x].insert(y);
 	adj[y].insert(x);
 }

 int cnt = 0;
 for(int i=1; i<=n; i++){
 	bool ok = true;
 	for(auto it = adj[i].begin(); it != adj[i].end(); ++it){
 		ok &= (h[i] > h[*it]);
 	}
 	if(ok) cnt++;
 }

 cout << cnt << "\n";

}

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

ans = float('inf')
for bit in range(1<<(n-1)):
  cand = [0]*(n-1)
  for i in range(n-1):
    if bit & 1<<i: cand[i] = 1
  if cand.count(1) != k-1: continue
  cost = 0
  mx = a[0]
  for i in range(1, n):
    if cand[i-1]:
      if a[i] <= mx:
        cost += mx-a[i]+1
        mx += 1
    mx = max(mx, a[i])
  ans = min(ans, cost)
print(ans)

Measured memory_bytes: 9128
#include <bits/stdc++.h>
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
#define e_b emplace_back
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
using namespace std;
using ll = long long;
using ld = long double;
template<class T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<class T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}

int main(){
  ios_base::sync_with_stdio(false);cin.tie(0);
  int X;
  cin >> X;

  if(X<600) cout << 8 << endl;
  else if(X<800) cout << 7 << endl;
  else if(X<1000) cout << 6 << endl;
  else if(X<1200) cout << 5 << endl;
  else if(X<1400) cout << 4 << endl;
  else if(X<1600) cout << 3 << endl;
  else if(X<1800) cout << 2 << endl;
  else if(X<2000) cout << 1 << endl;

  return 0;
}

Measured memory_bytes: 3688
#include <stdio.h>
#include <stdlib.h>
int N,K;

int cmpnum(const void * n1,const void * n2){
    if(*(int *)n1 < *(int *)n2)
	return 1;
    else if(*(int *)n1 > *(int *)n2)
	return -1;
    else 
	return 0;
}

int main()
{
    int leng[50]={0},sum=0;
    scanf("%d %d",&N,&K);
    for (int i=0;i<N;i++)
	scanf("%d",&leng[i]);

    qsort(leng,N,sizeof(int),cmpnum);

    for(int i=0;i<K;i++)
	sum+=leng[i];

    printf("%d\n",sum);
    return 0;
}




Measured memory_bytes: 128
n,a,b = map(int,input().split())
x = list(map(int,input().split()))
cost = [0]*n
cost[1] = min((x[1]-x[0])*a,b)
for i in range(2,n):
    cost[i] = min(cost[i-1]+(x[i]-x[i-1])*a,cost[i-1]+b)
print(cost[n-1])

Measured memory_bytes: 14252
void main()
{
    long n = rdElem;
    string s = rdStr;

    long[] r = new long[n+1], g = new long[n+1], b = new long[n+1];
    foreach (i, x; s)
    {
        r[i+1] += r[i];
        g[i+1] += g[i];
        b[i+1] += b[i];

        if (x == 'R') ++r[i+1];
        if (x == 'G') ++g[i+1];
        if (x == 'B') ++b[i+1];
    }

    long cnt;
    foreach (i; 0 .. n-2)
    {
        foreach (j; i+1 .. n-1)
        {
            long dist = j - i;
            if (s[i] == 'R')
            {
                if (s[j] == 'G')
                {
                    cnt += b[n] - b[j];
                    if (j + dist < n && s[j+dist] == 'B') --cnt;
                }
                if (s[j] == 'B')
                {
                    cnt += g[n] - g[j];
                    if (j + dist < n && s[j+dist] == 'G') --cnt;
                }
            }
            if (s[i] == 'G')
            {
                if (s[j] == 'R')
                {
                    cnt += b[n] - b[j];
                    if (j + dist < n && s[j+dist] == 'B') --cnt;
                }
                if (s[j] == 'B')
                {
                    cnt += r[n] - r[j];
                    if (j + dist < n && s[j+dist] == 'R') --cnt;
                }
            }
            if (s[i] == 'B')
            {
                if (s[j] == 'R')
                {
                    cnt += g[n] - g[j];
                    if (j + dist < n && s[j+dist] == 'G') --cnt;
                }
                if (s[j] == 'G')
                {
                    cnt += r[n] - r[j];
                    if (j + dist < n && s[j+dist] == 'R') --cnt;
                }
            }
        }
    }

    cnt.writeln;
}

enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;
enum double eps = 1.0e-9;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.mathspecial;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;
import core.bitop;

Measured memory_bytes: 2772
#include <iostream>
#include <math.h>
#include <iomanip>
using namespace std;

int main(){
   double a, b, deg, pi, unit, deg_r;
   cin >> a >> b >> deg;
   pi     = 2.0 * asin(1.0);            /* πの値 */
	 unit   = pi / 180.0;                 /* 度 → ラジアン */
   deg_r  = deg * unit;
   double S = 0.5 * a * b * sin(deg_r);
   double L = a + b + sqrt(pow(a,2) + pow(b,2) - 2*a*b*cos(deg_r));
   double h = b * sin(deg_r);
   cout << fixed << setprecision(16);
   cout << S << " " << endl;
   cout << L << " " << endl;
   cout << h << endl;
  }



Measured memory_bytes: 3492
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); i++)
#define int long long
#define double long double
#define P pair<long long,long long>
#define all(a) a.begin(),a.end()
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; }
using namespace std;

int n,m;
vector<vector<int>> g;
vector<vector<int>> f;
vector<bool> used;
vector<int> ans;
vector<int> node;

void dfs(int v){
    used[v]=true;
    for(int i:g[v]){
        if(!used[i])dfs(i);
    }
    node.push_back(v);
}

void dfs2(int v, int u){
    used[v]=true;
    ans[v]=u+1;
    for(int i:g[v]){
        if(!used[node[i]])dfs2(node[i],v);
    }
}

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

    cin>>n>>m;
    g.resize(n); f.resize(n);
    ans.resize(n); node.resize(n);
    used=vector<bool>(n,0);
    rep(i,n+m-1){
        int a,b; cin>>a>>b;
        a--; b--;
        g[a].push_back(b);
        f[b].push_back(a);
    }

    rep(i,n)if(f[i].size()==0)dfs(i);
    reverse(all(node));

    vector<int> tmp(n);
    rep(i,n)tmp[node[i]]=i;
    rep(i,n){
        int l=tmp[i];
        rep(j,g[l].size())g[l][j]=tmp[g[l][j]];
        sort(all(g[l]));
    }

    fill(all(used),false);
    dfs2(node[0],-1);

    rep(i,n)cout<<ans[i]<<endl;
    return 0;

}

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

int main() {
  string S;
  cin >> S;
  int count = 0;
  for(int i=1; i<S.size(); i++){
    if(S[i-1] != S[i]) count++;
  }

  cout << count << endl;
}

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

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pll;

const int Maxn = 3e5 + 10;
const int Maxk = 15;
const ll Inf = INT_MAX;

vector<pll> G[Maxn];
ll dis[Maxn];
struct edge {
	ll u, c, num;
};
bool CMP(edge a, edge b){
	return a.c < b.c;
}

vector<edge> H[Maxn];

deque<ll> deq;

int main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n, m;
	cin >> n >> m;
	ll u, v, c;
	edge x;
	for(int i = n + 1; i <= n + m; i++){
		cin >> u >> v >> c;
		x.num = i;
		x.u = u;
		x.c = c;
		H[v].pb(x);
	
		x.num = i;
		x.u = v;
		x.c = c;
		H[u].pb(x);
	
		G[u].pb({i, 1});
		G[i].pb({u, 0});
	
		G[v].pb({i, 1});
		G[i].pb({v, 0});
	}
	for(int i = 1; i <= n; i++){
		sort(all(H[i]), CMP);
		for(int j = 0; j + 1 < H[i].size(); j++){
			if(H[i][j].c == H[i][j + 1].c){
				G[H[i][j].num].pb({H[i][j + 1].num, 0});
				G[H[i][j + 1].num].pb({H[i][j].num, 0});
			}
		}
	}
	
	memset(dis, 31, sizeof dis);
	deq.pb(1);
	dis[1] = 0;
	ll fr;
	while(deq.size()){
		fr = deq.front();
		deq.pop_front();
		
		for(auto E : G[fr]){
			if(dis[E.F] > dis[fr] + E.S){
				dis[E.F] = dis[fr] + E.S;
				if(E.S == 0) deq.push_front(E.F);
				else deq.push_back(E.F);
			}
		}
	}
	
	
	cout << (dis[n] > Inf ? -1 : dis[n]) << '\n';
	return 0;
}


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

int getDight(int n){
    return (int)(log10(n) + 1);
}

void calculate(){
    int N;
    cin >> N;
    int res = 0;
    for(int i = 1;i <= N;++i){
        if(getDight(i) % 2 == 1) res++;
    }
    cout << res << '\n';
}

int main(int, char**) {
    calculate();
    return 0;
}


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

public class Main{ 
   static class Fast{
     public BufferedReader br;
     public StringTokenizer st;
     
     public Fast(){
          br =new BufferedReader(new InputStreamReader(System.in));
     }
     
     String next(){
          while(st==null || !st.hasMoreTokens()){
               try{
                    st=new StringTokenizer(br.readLine());
               }
               catch(IOException e){
                    throw new RuntimeException(e);
               }
               
          }
               return st.nextToken();
          }
     int nextInt(){
          return Integer.parseInt(next());
     }

     long nextLong(){
          return Long.parseLong(next());
     }

 }
  

	public static void main(String[] args)throws Exception{
         //StringTokenizer st;//! @ % & * () _ {} # ~ : < > ? "" | ^
          Fast f=new Fast();
         PrintWriter out = new PrintWriter(System.out);
        // StringBuilder str=new StringBuilder();
         //  int x=Integer.parseInt(st.nextToken());
         
        //st=new StringTokenizer(br.readLine()); 

        
        int n=f.nextInt();
        int W=f.nextInt();
        
        int w[]=new int[n+1];
        int v[]=new int[n+1];
        for (int i=1;i<=n;i++) {
          w[i]=f.nextInt();
          v[i]=f.nextInt();
        }

        long dp[][]=new long[n+1][W+1];
        
        for (int i=1;i<=n;i++) {
          for (int j=1;j<=W;j++) {
            dp[i][j]=dp[i-1][j];
            if (w[i]<=j) {
              dp[i][j]=Math.max(dp[i][j],v[i]+dp[i-1][j-w[i]]);
            }
          }
        }
        
        out.println(dp[n][W]);
        
        //out.println(mh);
    out.close();

}
}




Measured memory_bytes: 138316
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>
#include<iomanip>
#include<deque>
#include<random>
#include<set>
#include<bitset>
#include<cassert>

using namespace std;
typedef long long ll;
typedef double lldo;
#define mp make_pair
#define pub push_back
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
ll gcd(ll a, ll b) { if (a % b == 0) { return b; } else  return gcd(b, a % b); }
ll lcm(ll a, ll b) { if (a == 0) { return b; }return a / gcd(a, b) * b; }
template<class T>ll LBI(vector<T>& ar, T in) { return lower_bound(ar.begin(), ar.end(), in) - ar.begin(); }
template<class T>ll UBI(vector<T>& ar, T in) { return upper_bound(ar.begin(), ar.end(), in) - ar.begin(); }

ll n, k, c, ans = 0;
string s;
vector<ll> l, r;

int main() {
	cin >> n >> k >> c;
	vector<ll> cntL(n, -1), cntR(n, -1), lastL(n, -1), lastR(n, -1);
	cin >> s;
	auto cnt = [&]() {
		vector<ll> res;
		ll interval = 0;
		rep(i, n) {
			if ((s[i] != 'x' && interval > c) || i == 0) {
				res.pub(i);
				interval = 0;
			}
			interval++;
		}
		return res;
	};
	l = cnt();
	reverse(s.begin(), s.end());
	r = cnt();
	rep(i, sz(l)) {
		cntL[l[i]] = i + 1;
		lastL[l[i]] = l[i];
	}
	rep(i, sz(r)) {
		cntR[n - r[i] - 1] = i + 1;
		lastR[n - r[i] - 1] = n - r[i] - 1;
	}
	rep(i, n - 1) {
		if (cntL[i + 1] == -1)cntL[i + 1] = cntL[i];
		if (cntR[n - i - 2] == -1)cntR[n - i - 2] = cntR[n - i - 1];
		if (lastL[i + 1] == -1)lastL[i + 1] = lastL[i];
		if (lastR[n - i - 2] == -1)lastR[n - i - 2] = lastR[n - i - 1];
	}
	rep(i, n) {
		ll sum = 0;
		if (i > 0 && cntL[i - 1] != -1)sum += cntL[i - 1];
		if (i < n - 1 && cntR[i + 1] != -1)sum += cntR[i + 1];
		if (i > 0 && i < n - 1 && lastR[i + 1] - lastL[i - 1] <= c)sum--;
		if (sum < k)cout << i + 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 11380
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    double hMin = INT_MAX;
    double hMax = INT_MIN;

    for(;;){
        double n;
        if(!(cin >> n))
            break;

        hMin = min(hMin, n);
        hMax = max(hMax, n);
    }

    printf("%.10f\n", hMax - hMin);
    return 0;
}

Measured memory_bytes: 0