akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repR(i, n) for(int i = n; i >= 0; ++i)
#define FDS(i, n) for(ll i = 0; i < n; ++i)
#define FDSR(i, n) for(int i = n; i >= 0; ++i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define FORR(i, m, n) for(int i = m;i >= n;--i)
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define itn int
#define ednl endl
using namespace std;
typedef long long ll;
int main(){
	int N,K;
	string S;
	cin>>N;
	cin>>S;
	cin>>K;
	FDS(i,N){
		if(S.at(K-1)!=S.at(i)){
			cout<<'*';
		}
		else{
			cout<<S.at(i);
		}
	}
	cout<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int n,a,b,x,y;
	scanf("%d %d %d",&n,&a,&b);
	x=a*n;
	y=b;
	if(x>y){
		printf("%d\n",y);
	}
	else{
		printf("%d\n",x);
	}
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int n,a[101],c;
int main()
{
	int i,j,k;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	for(i=1;i<=n;i++)
	{
		for(j=i+1;j<=n;j++)
		{
			for(k=j+1;k<=n;k++)
			{
				if(a[i]==a[j] || a[j]==a[k] || a[i]==a[k])
				{
					continue;
				}
				if(a[i]+a[j]>a[k] && a[i]+a[k]>a[j] && a[j]+a[k]>a[i])
				{
					c++;
				}
			}
		}
	}
	cout<<c<<endl;
	return 0;
} 

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)

using namespace std;

namespace mp = boost::multiprecision;

using ll = long long;
using Bint = mp::cpp_int;
ll mod = pow(10, 9) + 7;

int main() {
    // source
    int n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    rep(i, n) { cout << s[i] << t[i]; }
    cout << endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <algorithm>
#include <sstream>
#include <istream>

using namespace std;

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


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

	int sum = 0;
	for(int i=0;i<n;i++) sum += w[i];

	int ans = 1000000;
	int tmp = 0;
	for(int i=0;i<n;i++){
		tmp += w[i];
		ans = min(ans,abs(tmp-(sum-tmp)));
	}
	cout << ans << endl;
	

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
 
#define INF 1000000007
#define LINF 1000000000000000007
 
typedef long long ll;
typedef pair<ll,ll> P;


int n, k, h[101010];

int main(){
	cin >> n >> k;
	for(int i = 0; i < n; i++){
		cin >> h[i];
	}
	
	sort(h, h+n);
	
	int cnt = INF;
	for(int i = 0; i <= n-k; i++){
		cnt = min(cnt, h[i+k-1] - h[i]);
	}
	
	cout << cnt << endl;
	
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#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)
typedef long long ll;
const int inf = 100100100;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
    int n,m; cin>>n>>m;
    vector<int> p(m);
    vector<string> s(m);
    rep(i,m)cin>>p[i]>>s[i];

    int ac_ans = 0, wa_ans = 0;
    pair<int,int> submit(0,0);
    vector<pair<int,int>> submits(n,submit);
    //for(auto x:submits)cout<< x.first<<' '<<x.second<<endl;

    rep(i,m){
        if(s[i] == "AC"){
            if(submits[p[i]-1].second == 0){ac_ans++; wa_ans += submits[p[i]-1].first; submits[p[i]-1].second = 1;}
        }else{
            submits[p[i]-1].first++;
        }
        //cout<<"--------------"<<endl;
        //for(auto x:submits)cout<< x.first<<' '<<x.second<<endl;
        //cout<<"--------------"<<endl;
    }

    cout<<ac_ans<<' '<<wa_ans<<endl;return 0;
}


Measured memory_bytes: 6912
#include <vector>
#include <iostream>

double sqrt(const int &n) {
	double a = n, b = 1;
	while ((a - b) * (a - b) < 0.1) {
		double min = (a + b) / 2;
		if (min * min > n) {
			a = min;
		}
		else {
			b = min;
		}
	}
	return a;
}
std::vector<bool> cul_prime(const int &n) {
	std::vector<bool> prime(n + 1, true);
	prime.at(0) = false;
	prime.at(1) = false;
	double root = sqrt(n) + 1;
	for (auto i = 2; i <= n >> 1; ++i) {
		prime.at(i << 1) = false;
	}
	for (auto i = 3; i < root; i += 2) {
		if (prime.at(i)) {
			for (auto j = 2; j <= n / i; ++j) {
				prime.at(i * j) = false;
			}
		}
	}
	return prime;
}
int main() {
	int n, x;
	std::cin >> n >> x;
	while (n != 0) {
		std::vector<bool> num(x + 1, false);
		std::vector<int> menu;
		for (auto i = 0; i < n; ++i) {
			int price;
			std::cin >> price;
			menu.push_back(price);
		}
		int max = 0;
		auto prime = cul_prime(x);
		num.at(0) = true;
		for (const auto &i : menu) {
			for (auto j = 0; j <= x - i; ++j) {
				if (num.at(j)) {
					if (j + i <= x) {
						num.at(j + i) = true;
						if (max < j + i && prime.at(j + i)) {
							max = j + i;
						}
					}
				}
			}
		}
		if (max == 0) {
			std::cout << "NA\n";
		}
		else {
			std::cout << max << "\n";
		}
		std::cin >> n >> x;
	}
	return 0;
}

Measured memory_bytes: 1448
mod = 10**9 + 7

S = input()
N = len(S)

dp = [[0]*13 for _ in range(N+1)]
dp[0][0] = 1

for i, s in enumerate(S):
    for j in range(13):
        if s == "?":
            for k in range(10):
                l = (10*j + k) % 13
                dp[i+1][l] += dp[i][j]
                dp[i+1][l] %= mod
        else:
            l = (10*j + int(s)) % 13
            dp[i+1][l] += dp[i][j]
            dp[i+1][l] %= mod

ans = dp[N][5]
print(ans)

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

  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n;
  n = abs(n - 1);
  out(n);
}

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

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

bool c[5000+2][5000+2];

bool t(int x,int y){
	if(x<0)return false;
	if(x>5000)return false;
	if(y<0)return false;
	if(y>5000)return false;
	return c[x][y];
}

int main(){
	vector<pair<int,int>> vp;
	while(1){
		int n,ans=0;
		pair<int,int> p[3002];
		scanf("%d",&n);
		if(n==0)break;
		int ss=vp.size();
		for(int i=0;i<ss;i++)c[vp[i].first][vp[i].second]=false;
		vp.clear();
		for(int i=0;i<n;i++){
			scanf("%d%d",&p[i].first,&p[i].second);
			c[p[i].first][p[i].second]=true;
			vp.push_back(p[i]);
		}
		for(int i=0;i<n;i++){
			for(int j=i+1;j<n;j++){
				if(t(p[i].first+p[i].second-p[j].second,p[i].second+p[j].first-p[i].first)&&t(p[j].first+p[i].second-p[j].second,p[j].second+p[j].first-p[i].first))ans=max(ans,(p[i].first-p[j].first)*(p[i].first-p[j].first)+(p[i].second-p[j].second)*(p[i].second-p[j].second));
				//if(t(p[i].first-p[i].second+p[j].second,p[i].second-p[j].first+p[i].first)&&t(p[j].first-p[i].second+p[j].second,p[j].second-p[j].first+p[i].first))ans=max(ans,(p[i].first-p[j].first)*(p[i].first-p[j].first)+(p[i].second-p[j].second)*(p[i].second-p[j].second));
			}
		}
		printf("%d\n",ans);
	}
}

Measured memory_bytes: 25072
parseInt(x)=parse(Int, x)
parseMap(x::Array{SubString{String},1})=map(parseInt, x)

function main()
	k = readline() |> parseInt
	a,b = readline() |> split |> parseMap
	if a%k==0||b%k==0
		println("OK")
	else
		println(div(a,k)==div(b,k) ? "NG" : "OK")
	end
end

main()

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

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 100005

int n , m;
int l[MAXX];
int r[MAXX];

int main()
{
    _FastIO;
    cin >> n >> m;
    int x = 1;
    int y = n;
    for(int i = 0; i < m; i++){
        cin >> l[i] >> r[i];
        x = max(x , l[i]);
        y = min(y , r[i]);
    }
    int ans = y - x + 1;
    cout << max(0 , ans) << endl;
    return 0;
}


Measured memory_bytes: 1024
use std::io;
use std::collections::VecDeque;

fn main() {
    let mut input = Input::new();
    let n: usize = input.next();
    let mut a: Vec<i64> = vec![0;n];
    let mut b: Vec<i64> = vec![0;n];
    for i in 0..n {
        a[i] = input.next();
        b[i] = input.next();
    }
    let mut x: i64 = 0;
    for i in 0..n {
        let t = (a[n - i - 1] + x) % b[n - i - 1];
        if t > 0 {
            x += b[n - i - 1] - t;
        }
    }
    println!("{}", x);
}

struct Input {
    queue: VecDeque<String>,
}

impl Input {
    fn new() -> Input {
        Input { queue: VecDeque::new() }
    }

    fn next<T>(&mut self) -> T
        where T: std::str::FromStr,
              T::Err: std::fmt::Debug
    {
        if self.queue.is_empty() {
            let mut line = String::new();
            let _ = io::stdin().read_line(&mut line);
            for x in line.split_whitespace() {
                self.queue.push_back(String::from(x));
            }
        }
        return self.queue.pop_front().unwrap().parse::<T>().unwrap();
    }
}



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

#define step(i, s, n, d) for(int i=s; i<n; i+=d)
#define FOR(i,s,n) step(i,s,n,1)
#define rep(i,n) FOR(i,0,n)
#define gets(x) x; cin >> x;
#define puts(x) x; cout << x << endl;
#define list_input(x, n) x[n]; rep(i,n){ gets(x[i]);}
#define ll long long
typedef pair<int, int> P;

int main(){
  int N, odd = 0, even = 0;
  cin >> N;
  ll a[N];
  rep(i, N){
    cin >> a[i];
  }
  rep(i, N){
    if (a[i] % 2 == 0) {
      even += 1;
    }else{
      odd += 1;
    }
  }
  if (odd % 2 == 0) {
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ALL(x) (x).begin(),(x).end()
#define PB push_back
#define MP make_pair
#define Mod 998244353
using namespace std;
using lint = long long;
using vi = vector<lint>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;

// cout << fixed << setprecision(12)

int main(){
  lint a;
  cin >> a;
  cout << a + pow(a,2) + pow(a,3) << endl;
}

Measured memory_bytes: 4224
#include<bits/stdc++.h>
#define x first
#define y second
#define pii pair<LL,LL>
#define Get_y(i) 2ll*(f[i]+s[i])+(LL)i*i-(LL)i
#define rev(X) reverse(X+1,X+n+1)
#define mem(a,b) memset(a,b,sizeof(a))
#define  For(i,a,b) for(int i=a,i##E=b;i<=i##E;++i)
#define rFor(i,a,b) for(int i=a,i##E=b;i>=i##E;--i)
typedef long long LL;
using namespace std;
const int N=300010;
template<typename T>inline bool chkmin(T &a,const T &b){return a>b?a=b,1:0;}
template<typename T>inline bool chkmax(T &a,const T &b){return a<b?a=b,1:0;}
template<typename T>inline void read(T &x)
{
	x=0;int _f(0);char ch=getchar();
	while(!isdigit(ch))_f|=(ch=='-'),ch=getchar();
	while( isdigit(ch))x=x*10+ch-'0',ch=getchar();
	x=_f?-x:x;
}
inline void file()
{
#ifdef ztzshiwo
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
#endif
}
int n,m,top;
LL a[N],f[N],g[N],F[N],s[N],tmp[N];
pii q[N];
inline LL Query(LL i)
{
	while(top>=2&&q[top].y-q[top-1].y<=2ll*i*(q[top].x-q[top-1].x))
		top--;
	return q[top].x;
}
inline void Push(pii a)
{
	while(top>=2&&(q[top].y-q[top-1].y)*(a.x-q[top-1].x)
				<=(a.y-q[top-1].y)*(q[top].x-q[top-1].x))
		top--;
	q[++top]=a;
}
inline void Get_s(){For(i,1,n)s[i]=s[i-1]+a[i];}
inline void Get_f(LL *f)
{
	Push(pii(0,0));
	For(i,1,n)
	{
		LL j=Query(i);
		f[i]=max(f[i-1],f[j]+(i-j+1)*(i-j)/2-s[i]+s[j]);
		Push(pii(i,Get_y(i)));
	}
	top=0;
}
inline void Solve(int l,int r)
{
	if(l==r)
	{
		chkmax(F[l],f[l-1]+g[l+1]+1-a[l]);
		return;
	}
	int mid=(l+r)>>1;
	For(i,l,mid)Push(pii(i,Get_y(i)));
	For(i,mid+1,r)
	{
		LL j=Query(i);
		tmp[i]=f[j]+(i-j+1)*(i-j)/2-s[i]+s[j]+g[i+1];
	}
	rFor(i,r,mid+1)
	{
		if(i^r)chkmax(tmp[i],tmp[i+1]);
		chkmax(F[i],tmp[i]);
	}
	top=0;
	Solve(l,mid);Solve(mid+1,r);
}
int main()
{
	int x,y;
	file();
	read(n);
	For(i,1,n)read(a[i]),F[i]=1-a[i];
	Get_s();
	Get_f(f);rev(a);Get_s();
	Get_f(g);rev(a);Get_s();rev(g);
	//For(i,1,n)printf("%d %lld %lld\n",i,f[i],g[i]);
	Solve(0,n);
	swap(f,g);
	rev(f);rev(g);rev(F);rev(a);Get_s();
	Solve(0,n);
	rev(f),rev(g),rev(F);rev(a);Get_s();
	//For(i,1,n)printf("%lld ",F[i]);
	swap(f,g);
	read(m);
	For(i,1,m)
	{
		read(x),read(y);
		printf("%lld\n",max(f[x-1]+g[x+1],F[x]+a[x]-y));
	}
	return 0;
}


Measured memory_bytes: 17280
N = int(input())
arra = list(map(int,input().split()))
arrb = list(map(int,input().split()))

hero_res = 0
def_cnt = 0
for i in range(0,N+1):
    nmons = arra[i]
    mons_res = max(nmons - hero_res, 0)
    def_cnt += nmons - mons_res

    if i < N:
        hero = arrb[i]
        mons_res_2 = max(mons_res - hero, 0)
        def_cnt += mons_res - mons_res_2
        hero_res = hero - (mons_res - mons_res_2)
print(def_cnt)

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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end())
#define vdelete(v) (v).erase(unique(all(v)), (v).end())
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF 9223372036854775807

int n,k;
vector<pair<int,int>> v,ans;
map<pair<int,int>,bool> m;

signed main() {
    cin >> n >> k;
    int hoge = (n-1)*(n-2)/2;
    if (hoge < k) {
        cout << -1 << endl;
        return 0;
    }
    rep1(i,n) rep1(j,i) if (i^j) v.pb(mp(min(i,j),max(i,j)));
    for(auto i : v) {
        if (i.fi == 1 || m[i] || !k) {
            ans.pb(i);
            continue;
        }
        m[mp(1,i.fi)] = true;
        m[mp(1,i.se)] = true;
        k--;
    }
    cout << ans.size() << endl;
    for(auto i : ans) cout << i.fi << " " << i.se << endl;
}






Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,t,h,l,m10=0,m100=0,z=0;
    cin>>n>>m10>>m100>>l;
    int a[n][2];
  for(int i=0;i<n;i++){
    cin>>a[i][0]>>a[i][1];
  }
  long long c=0;
  while(1){
    if(a[c%n][0]){
      if(m10+1>l)goto L;
      a[c%n][0]--;
      z++;
      m10++;
    }
    else if(a[c%n][1]){
      a[c%n][1]--;
      z+=10;
      m100++;
    }
    else goto L;
    if(z>=9){
      if(m10<z-9)goto L;
      a[c%n][0]+=z-9;
      m10-=z-9;
      z=0;
    }c++;
  }
 L:;cout<<(c)%n+1<<endl;
}

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

using namespace std;

int main() {
  int x, n;
  cin >> x >> n;
  vector<int> v(110, 0);
  for (int i = 0; i < n; i++) {
    int p;
    cin >> p;
    v[p] = 1;
  }

  int diff = 1e9, ans = 1e9;
  for (int i = 0; i <= 101; i++) {
    if (v[i]) continue;
    if (abs(x - i) < diff) {
      diff = abs(x - i);
      ans = i;
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
#include <vector>
#include <cmath>
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP2(i, m, n) for (int i = (m); i < (int)(n); ++i)
#define REPR(i, n) for (int i = (n)-1; i >= 0; --i)
#define REPR2(i, m, n) for (int i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a) sort(ALL(a), greater<int>())
#define REVERSE(a) reverse(ALL(a))
#define bit_search(bit, n) REP(bit, 1<<(n))
#define bit_check(bit, i) (bit>>(i)) & 1
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) lower_bound(ALL(a), (x)) - a.begin()
#define bisect_right(a, x) upper_bound(ALL(a), (x)) - a.begin()
#define INPUT(a) REP(i, a.size()) cin >> a[i];
#define INPUTP(a) REP(i, a.size()) cin >> a[i].first >> a[i].second;
#define ENDL cout << endl;
using namespace std;
using LL = long long;
using LD = long double;
using PII = pair<int, int>;
using VPII = vector<PII>;
using PLL = pair<LL, LL>;
using VPLL = vector<PLL>;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VC = vector<char>;
using VS = vector<string>;
using VB = vector<bool>;
const LL INF = 1e18;
const LL MOD = 1e9 + 7;

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()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  double a, b, x, t;
  cin >> a >> b >> x;
  if (x >= a*a*b/2) t = 360 * atan(2*b/a-2*x/(a*a*a)) / (2*M_PI);
  else t = 360 * (M_PI/2 - atan(2*x / (a*b*b))) / (2*M_PI);
  cout << setpre(10) << t << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 1e18
#define MOD 1000000007
#define PI M_PI
#define ll long long
#define vi vector<int>
#define all(v) v.begin(), v.end()
#define FOR(i, a, b) for (int i=a; i<b; i++)
#define REP(i, n) for (int i=0; i<n; i++)
#define REPD(i, n) for (int i=n-1; i>=0; i--)
#define print(x) cout << x << endl;
#define debug(x) cout << #x << " = " << endl;

using namespace std;

void solve()
{
    int N, M;
    cin >> N >> M;
    vector<int> L(M), R(M);
    REP(i, M) cin >> L[i] >> R[i];
  
    int xmin = 1;
    int xmax = N;
    REP(i, M) {
        xmin = max(L[i], xmin);
        xmax = min(R[i], xmax);
    }
    if (xmin > xmax) {
        print(0);
    } else {
        print(xmax - xmin + 1);
    }
}

int main()
{
    solve();

    return 0;
}


Measured memory_bytes: 1024
n = int(input())
from math import ceil

tkhs = 1
aoki = 1

for _ in range(n):
    t, a = map(int, input().split())
    k = max((tkhs+t-1)//t, (aoki+a-1)//a)
    tkhs = k*t
    aoki = k*a

print(tkhs+aoki)



Measured memory_bytes: 38768
import java.util.*;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();

		if(a >= b) {
			System.out.println("delicious");
		} else {
			// if(x < b - a) {
			if(a - b < -x) {
				System.out.println("dangerous");
			} else {
				System.out.println("safe");
			}
		}
	}
}


Measured memory_bytes: 21844
from collections import defaultdict

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

cnt = defaultdict(int)
for a in A:
    cnt[a] += 1
ttl = sum(A)

Q = int(input())
for _ in range(Q):
    b, c = map(int, input().split())
    
    if b in cnt:
        occ = cnt.pop(b)
        cnt[c] += occ
        ttl = ttl - b * occ + c * occ
    
    print(ttl)

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

// macro
#define rep(i,n) for(i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
int main()
{
  int n;cin>>n;
  vector<int> a(n);
  int i,j;
  rep(i,n)cin>>a[i];
  bool fin=false;
  rep(i,n)
  {
    rep(j,n)
    {
      if(i==j)continue;
      if(abs(a[i]-a[j])%(n-1)==0)
      {
        cout<<a[i]<<' '<<a[j]<<endl;
        fin=true;
        break;
      }
    }
    if(fin)break;
  }
}



Measured memory_bytes: 3104
#include<stdio.h>
int main(void) {
  
  int a[4][3][10] = {0};
  int n,b,f,r,v;
  
  scanf("%d",&n);
  for(int l=1;l<=n;l++) {
    scanf("%d%d%d%d",&b, &f, &r, &v);
    a[b-1][f-1][r-1] += v;
  }
  
  for(int m=0;m<4;m++) {
    for(int n=0;n<3;n++) {
      for(int o=0;o<10;o++) {
        if(a[m][n][o] == 0) printf(" %d",0);
        else printf(" %d",a[m][n][o]);
      }
      printf("\n");
    }
    if(m!=3) printf("####################\n");
  }
  
  return 0;
}




Measured memory_bytes: 2028
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		for(int i=1;i<=B;i++){
			if(i * A % B == C){
				Console.WriteLine("YES");
				return;
			}
		}
		
		Console.WriteLine("NO");
		
		
	}
	long A,B,C;
	public Sol(){
		var d = rla();
		A = d[0]; B = d[1]; C = d[2];
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
	int a, b, c, x, y; cin >> a >> b >> c >> x >> y;
	int res = INT_MAX;
	for (int i = 0; i <= max(x, y) * 2; i += 2) {
		int t = c * i;
		t += max(0, x - i / 2) * a;
		t += max(0, y - i / 2) * b;
		res = min(res, t);
	}
	cout << res << endl;
}

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

bool ok(i64 c, i64 k, vector<i64> a, vector<i64> f)
{
  i64 cnt = 0;
  i64 size = a.size();
  for (i64 i = 0; i < size; i++)
    if (c < a[i] * f[i])
      cnt += a[i] - c / f[i];
  return cnt <= k;
}

int main()
{
  i64 n, k;
  cin >> n >> k;
  vector<i64> a(n), f(n);
  for (i64 i = 0; i < n; i++)
    cin >> a[i];
  for (i64 i = 0; i < n; i++)
    cin >> f[i];
  sort(a.begin(), a.end());
  sort(f.begin(), f.end(), greater<i64>());
  i64 l = -1, r = 1e18;
  for (i64 _ = 0; _ < 100; _++)
  {
    i64 mid = (l + r) / 2;
    if (ok(mid, k, a, f))
      r = mid;
    else
      l = mid;
  }
  cout << r << endl;
  return 0;
}


Measured memory_bytes: 6552
import java.util.Scanner;
 
class Main {
 
	public static void main(String[] args) {
		
		Scanner stdIn = new Scanner(System.in);
		
		char L = 'a';
		char A[] = new char[26];
		int i;
	
		String B = stdIn.next();

		for(i=0;i<=(25);i++){
			A[i]=L++;
		}
		
		for(i=0;i<=(25);i++){
			if(B.charAt(0) == A[i]){
				System.out.println(A[++i]);
				break;
			}
		}

	}
    
}

Measured memory_bytes: 22740
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
typedef long double ld;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
#define qrep(que, ite) for(auto ite=begin(que) ; ite!=end(que) ; ite++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1LL<<60;
const int inf = 1e5;
//typedef long double ld;
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; }
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) {
        return -par[root(x)];
    }
};
ll gcd(ll a, ll b) { return a ? gcd(b%a, a) : b; };
int main(){
  ll N; cin>>N;
  vector<ll> v;
  ll sum=0;
  set<ll> se;
  for(ll i=1 ; ; i++){
    sum += i;
    se.insert(i);
    if(sum>=N){
      ll st = sum-N;
      if(st) se.erase(st);
      for(auto j : se) cout<<j<<endl;
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 512
///HELLO THERE~!
///CREATED BY MD SADMAN MEHEDI SIVAN(IUT CSE-SWE^19)

#include <bits/stdc++.h>

#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define read freopen("blue.txt","r",stdin);
#define write freopen("red.txt","w",stdout);
#define pie 2*acos(0.0);

typedef long long ll;

using namespace std;


int main()

{

    fastio;

    long long N;
    cin>>N;

    long long totalsum=0;

    for(long long i=1;i<=N;i++)
    {
         if(i%3==0 || i%5==0 ||i%15==0)
            continue;

        totalsum=totalsum+i;

    }
    cout<<totalsum;
    return 0;

}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define takeline cin.ignore();
#define sc second
#define N 3000005
#define endl "\n"
#define mod 1000000007
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
int main(){
	
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	if(a==2){
		if(b>=28) cout<<"1";
		else cout<<"0";
		return 0;
	}
	if(a<=7){
		if(a%2){
			if(b==31) cout<<"1";
			else cout<<"0";
		}
		else{
			if(b==30) cout<<"1";
			else cout<<"0";
		}
	}
	else{
		if(a%2==0){
			if(b==31) cout<<"1";
			else cout<<"0";
		}
		else{
			if(b==30) cout<<"1";
			else cout<<"0";
		}
	}

	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;


int main(){

  int c,n;
  cin >> n >> c;
  
  int cost[c][c];
  REP(i,c){
    REP(j,c){
      cin >> cost[i][j];
    }
  }
  
  vector<int> iro1,iro2,iro3;
  
  REP(i,n){
    REP(j,n){
      int a;
      cin >> a;
      if((i+j) % 3 == 0) iro1.push_back(a);
      if((i+j) % 3 == 1) iro2.push_back(a);
      if((i+j) % 3 == 2) iro3.push_back(a);
    }
  }
  
  int c1[c],c2[c],c3[c];
  
  REP(i,c){
    int sum = 0;
    REP(j,iro1.size()){
      sum += cost[iro1[j]-1][i];
    }
    c1[i] = sum;
  }
  
  REP(i,c){
    int sum = 0;
    REP(j,iro2.size()){
      sum += cost[iro2[j]-1][i];
    }
    c2[i] = sum;
  }
    
  REP(i,c){
    int sum = 0;
    REP(j,iro3.size()){
      sum += cost[iro3[j]-1][i];
    }
    c3[i] = sum;
  }
  
  int ans = MOD;
  REP(i,c){
    REP(j,c){
      REP(k,c){
        if(i != j && j != k && k != i){
          ans = min(ans,c1[i]+c2[j]+c3[k]);
        }
      }
    }
  }
  
  cout << ans << endl;
  
 return 0;
}

Measured memory_bytes: 1520
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define vec(s) vector

#define vvec(s) vector<vector
>
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Yes(x) cout<<(x?"Yes":"No")<<endl;
#define YES(x) cout<<(x?"YES":"NO")<<endl;
#define out(s) cout<<s<<endl;
#define pb(s) push_back(s);
#define sp " " 
#define INF 10000000000
#define LINF 9000000000000000000
#define all(s) s.begin(),s.end()
void vout(vi v){
    for(lli i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    cout << std::fixed << std::setprecision(10);
    lli ans=0;
    string s;
    cin>>s;
    lli tmp=0;
    rep(i, s.size()) {
        if (s[i]=='A'||s[i]=='T'||s[i]=='G'||s[i]=='C') {
            tmp++;
        }
        else{ 
            ans=max(ans, tmp);
            tmp=0;
        }
    }
    ans=max(ans, tmp);
    out(ans);
}

Measured memory_bytes: 3576
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <utility>
#define maxn 100005
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int n,m,x[maxn];
int main(){
	scanf("%d%d",&n,&m);
	for(int i = 1;i <= m;i++) scanf("%d",&x[i]);
	if(n >= m){
		puts("0");
		return 0;
	}
	sort(x + 1,x + m + 1);
	int ans = x[m] - x[1];
	for(int i = 1;i < m;i++) x[i] = x[i + 1] - x[i];
	m--;
	sort(x + 1,x + m + 1,greater<int>());
	for(int i = 1;i < n;i++){
		ans -= x[i];
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 640
if __name__ == '__main__':
    # ??????????????\???
    S_size = int(input())
    S = set([int(x) for x in input().split(' ')])
    T_size = int(input())
    T = set([int(x) for x in input().split(' ')])
    # S = [1, 2, 3, 4, 5, 1]
    # T = set([3, 4, 1])

    # ????????????
    U = S.intersection(T)

    # ???????????????
    print('{0}'.format(len(U)))

Measured memory_bytes: 8440
from functools import reduce
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

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


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


print(reduce(gcd, A))


Measured memory_bytes: 14748
#include <bits/stdc++.h>
using namespace std;
int main() {
  set<string> result;
  int n;
  cin >> n;
  for (int i=0; i<n; i++) {
    string t;
    cin >> t;
    result.insert(t);
  }
  cout << result.size() << endl;
}

Measured memory_bytes: 19260
class Dice
  attr_reader :top, :bottom, :front, :back, :left, :right #dice.top????????§???????????????????????????

  def initialize(dice_numbers) #dice????????????????¨??????????
    @top = dice_numbers[0]
    @back = dice_numbers[1]
    @right = dice_numbers[2]
    @left = dice_numbers[3]
    @front = dice_numbers[4]
    @bottom = dice_numbers[5]
  end

  def roll_dice(order_top, order_back)
      while true
        order = []
        order << ['N', 'W'].sample
        execute_order(order)
      break if @top == order_top && @back == order_back
    end
    # p "[#{@top}, #{@back}, #{@right}, #{@left}, #{@front}, #{@bottom}]"
  end

  # p "[#{top}, #{back}, #{right}, #{left}, #{front}, #{bottom}]"
  private #class?????§????????????????????????
  def move_north
    tmp = @top
    @top = @back
    @back = @bottom
    @bottom = @front
    @front = tmp
  end

  def move_west
    tmp = @top
    @top = @right
    @right = @bottom
    @bottom = @left
    @left = tmp
  end

  def execute_order(orders) #???????????????????????§????????????????????????????????????
      orders.each do |order| #??????????????????????????¨????????????????????¢?????????
        if order == "N"
          move_north
        elsif order == "S" #3???north?????¢????????¨1???south?????¢??????????????¨????????¶????????????
          3.times do
            move_north
          end
        elsif order == "W"
          move_west
        elsif order == "E" #3???east?????¢????????¨1???west?????¢??????????????¨????????¶????????????
          3.times do
            move_west
          end
        else
          puts "error!" #?????¬????????????????????????
        end
      end
  end
end

dice_numbers = gets.chomp.split.map(&:to_i)
n = gets.chomp.to_i
answers = []
n.times do
  orders = gets.chomp.split.map(&:to_i)
  dice = Dice.new(dice_numbers)
  dice.roll_dice(orders[0], orders[1])
  answers << dice.right
end
answers.each do |answer|
  puts answer
end

Measured memory_bytes: 8652
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()

const int INF = 1001001001;
int ans = INF;
int n, m, x;
vector<vector<int>> a(15, vector<int> (15));
vector<int> c(15);

void dfs(int y, bool buy, vector<int> cnt, int mon) {
    if (buy) {
        mon += c[y];
        rep(i, m) cnt[i] += a[y][i];
    }

    if (y == n-1) {
        bool flag = true;
        rep(i, m) if (cnt[i] < x) flag = false;
        if (flag) ans = min(ans, mon);
        return;
    }

    dfs(y+1, true, cnt, mon);
    dfs(y+1, false, cnt, mon);
}

int main() {
    cin >> n >> m >> x;
    rep(i, n) {
        cin >> c[i];
        rep(j, m) {
            cin >> a[i][j];
        }
    }
    int mon = 0;
    vector<int> cnt(15);
    dfs(0, true, cnt, mon);
    dfs(0, false, cnt, mon);

    if (ans == INF) cout << -1 << endl;
    else cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3632
import java.util.*;
class Main{
	static Scanner s = new Scanner(System.in);
	public static void main(String[] args) {
		long a,b;
		String op;
		while(s.hasNext()) {
			a  = Integer.parseInt(s.next());
			op =                  s.next() ;
			if(op.equals("?"))
				return;
			b  = Integer.parseInt(s.next());

			switch (op) {
			case "+":
				System.out.println(a+b);
				break;
			case "-":
				System.out.println(a-b);
				break;
			case "*":
				System.out.println(a*b);
				break;
			case "/":
				System.out.println((int)(1.0*a/b));
				break;
			}
		}
	}
}

Measured memory_bytes: 25984
#include <bits/stdc++.h>
#include <iostream>
#include <vector>

#define FOR(i, a, b) for (int i = a; (i) < (b); ++(i))
#define REP(i, n) FOR(i, 0, n)

using namespace std;

template<class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
bool chmix(T& a, const T& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

#define ALL(x) (x).begin(), (x).end()
template<class T>
using vc = vector<T>;
using vi = vc<int>;
using vvi = vc<vi>;

using ll = long long;

int main() {
    cout << setprecision(20) << fixed;

    long double a, b, c;
    cin >> a >> b >> c;
    const auto rad = c * M_PI / 180;
    const auto S = 0.5 * a * b * sin(rad);
    const auto L = sqrt(a * a + b * b - 2 * a * b * cos(rad)) + a + b;
    const auto h = b * cos(M_PI /2 - rad);
    cout << S << endl << L << endl << h << endl;
    return 0;
}



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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = (int)1e9;
const ll  inf = (ll)1e18;
const int mod = 1000000007;
const int MAX_N = 100010;
const double PI = acos(-1);

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	/*------------------------------*/

	string s;
	cin >> s;

	int a = 0, b = 0, c = 0;
	rep(i, sz(s)) {
		if (s[i] == 'a') {
			a++;
		}
		if (s[i] == 'b') {
			b++;
		}
		if (s[i] == 'c') {
			c++;
		}
	}

	int ma = max(a, max(b, c));
	int mi = min(a, min(b, c));

	if (ma - mi <= 1) {
		out("YES");
	}
	else {
		out("NO");
	}

	return 0;
}

Measured memory_bytes: 512
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int A,B;
    cin >> A >>B;
    
    if(A == 1){
        A = 14;
    }    
    if(B == 1){
        B = 14;
    }    
    if(A > B){
        cout << "Alice" <<  endl;
    }    
    if(A < B){
        cout << "Bob" << endl;
    }    
    else if(A == B){
        cout << "Draw" << endl;
    }
    
    
}


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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl




typedef long long ll;
const ll mod = 1e9+7;
const int maxn = 103;

const int inf = 1e9;

int n, m;
set<pair<int,int>> g[maxn];

struct edge {
    int u,v,w;
};


vector<edge> edges;

int dist[maxn][maxn];

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


    cin>>n>>m;

    for (int i=0; i<n; i++) {
	for (int j=0; j<n; j++) {
	    dist[i][j]=inf;
	    if (i==j) dist[i][j]=0;
	}
    }

    
    for (int i=0; i<m; i++) {
	int u,v,w; cin>>u>>v>>w;
	--u; --v;
	g[u].insert({w,v});
	g[v].insert({w,u});
	dist[u][v]=dist[v][u]=w;
	edges.push_back(edge{u,v,w});
    }

    

    for (int k=0; k<n; k++) {
	for (int i=0; i<n; i++) {
	    for (int j=0; j<n; j++) {
		dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j]);
	    }
	}
    }


    int res = m;

    for (auto ed: edges) {
	int u=ed.u;
	int v=ed.v;
	int w=ed.w;
	bool shortest = false;
	for (int i=0; i<n; i++) {
	    if (dist[i][u]+w == dist[i][v]) {
		shortest=true;
	    }
	}
	if (shortest) {
	    res--;
	}
    }


    cout<<res<<endl;

    return 0;
}


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

int main() {
	int n;
	cin >> n;
	vector<double> a(n);
	rep(i, n) cin >> a[i];
	double ans = 0.0;
	rep(i, n) ans += 1 / a[i];
	ans = 1 / ans;
	cout << setprecision(10) << fixed << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define DEBUGP(val) cerr << #val << "=" << val << "\n"

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const ll mod = 1e9 + 7;



int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  VI x(n + 1), y(n + 1), t(n + 1);
  REP(i, 1, n + 1) {
    cin >> t[i] >> x[i] >> y[i];
  }
  REP(i, 0, n) {
    int dist = abs(x[i] - x[i + 1]) + abs(y[i] - y[i + 1]);
    int dif = t[i + 1] - t[i];
    if (dist <= dif && (dist + dif) % 2 == 0) {
      continue;
    }
    cout << "No\n";
    return 0;
  }
  cout << "Yes\n";
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); ++i)
#define rep0(i,n) for (int i=0; i<=(int)(n); ++i)
#define rep1(i,n) for (int i=1; i<=(int)(n); ++i)
#define rrep(i,n) for (int i=(int)(n)-1; i>=0; --i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;
using llGraph = vector<vl>;
using vb = vector<bool>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int MOD = 1e9+7;
const int MOD2 = 998244353;
const double EPS = 1e-9;

template<typename T>
struct is_vector : false_type{};

template<typename T>
struct is_vector<vector<T>> : true_type{};

template<typename T>
ostream &operator << (ostream &ostr, const vector<T> &vec) {
  if (vec.empty()) {
    return ostr;
  }
  ostr << vec.front();
  for (auto itr = ++vec.begin(); itr != vec.end(); ++itr) {
    if (is_vector<T>()) ostr << "\n" << *itr;
    else ostr << ' ' << *itr;
  }
  return ostr;
}

template<typename T>
bool CompareBySecond(pair<T, T> a, pair<T, T> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}

template<typename T>
T GCD(T a, T b) {
  T c = a % b;
  while (c != 0) { a = b; b = c; c = a % b; }
  return b;
}


/* -------- <templates end> -------- */


void solve() {
  int n, a, b; cin >> n >> a >> b;
  cout << min(a, b) << ' ' << max(0, a+b - n) << endl;
}


/* -------- <programs end> -------- */


int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(12);
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main () {
  int N;
  cin >> N;
  vector<int> data(N);
  for(int i = 0; i < N; i++){
    cin >> data.at(i);
  }
  sort(data.begin(), data.end());
  if(data.at(N / 2 - 1) == data.at(N / 2))cout << 0 << endl;
  else cout << data.at(N / 2) - data.at(N / 2 - 1) << endl;
  return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main(){
    int n;
    cin >> n;
    int num = 1000;
    if(n > 1000 && n <= 2000){
        num = 2000;
    }
    else if(n > 2000 && n <= 3000){
        num = 3000;
    }
    else if(n > 3000 && n <= 4000){
        num = 4000;
    }
    else if(n > 4000 && n <= 5000){
        num = 5000;
    }
    else if(n > 5000 && n <= 6000){
        num = 6000;
    }
    else if(n > 6000 && n <= 7000){
        num = 7000;
    }
    else if(n > 7000 && n <= 8000){
        num = 8000;
    }
    else if(n > 8000 && n <= 9000){
        num = 9000;
    }
    else if(n > 9000 && n <= 10000){
        num = 10000;
    }
    int result = num - n;
    cout << result << endl;
    return 0;
}

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

using namespace std;
using ll = long long;

int main() {
	int n; ll k; scanf("%d %lld", &n, &k);
	vector<vector<int>> binLayer(61, vector<int>(n));
	for (int i = 0; i < n; ++i) scanf("%d", &binLayer[0][i]);
	for (int i = 0; i < n; ++i) --binLayer[0][i];
	for (int layer = 1; layer < binLayer.size(); ++layer) {
		for (int i = 0; i < n; ++i) binLayer[layer][i] = binLayer[layer-1][binLayer[layer-1][i]];
	}
	int cPos = 0;
	for (int jmp = 60; jmp >= 0; --jmp) {
		if ((1LL << jmp) <= k) {
			cPos = binLayer[jmp][cPos];
			k -= (1LL << jmp);
		}
	}
	printf("%d\n", cPos + 1);
	return 0;
}


Measured memory_bytes: 51856
//c
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		int m = sc.nextInt();

		int[] x = new int[m];

		x[0] = sc.nextInt();

		int min = x[0];

		int max = x[0];

		for(int i=1;i<m;i++) {

			x[i] = sc.nextInt();

			if(max<x[i]) max = x[i];

			if(min>x[i]) min = x[i];
		}

		if(n==1&&m==1) {
			System.out.println(0);
		}else if(n==1) {

			System.out.println((max-min));

		}else if(m==1){
			System.out.println(0);
		}else if(n==2) {

			int maxx = 0;

			Arrays.sort(x);

			for(int i=1;i<m;i++) {

				int a = Math.abs(x[i]-x[i-1]);

				if(maxx<a) maxx = a;
			}

			System.out.println((max-min-maxx));

		}	else {

			Arrays.sort(x);

			int a = 0;

			int b = 0;

			ArrayList<Integer> array = new ArrayList<>();
			ArrayList<Integer> aa = new ArrayList<>();

			for(int i=1;i<m;i++) {

				a = x[i]-x[i-1];

				aa.add(a);

			}

			Collections.sort(aa);

			for(int i=0;i<n-1;i++) {

				if(aa.size()-i-1>=0)b += aa.get(aa.size()-i-1);
			}

			//System.out.println(b);
			System.out.println((max-min-b));


		}

	}

}


Measured memory_bytes: 50532
#include<stdio.h>
#include<stdlib.h>
int main(void){
	int A,B,C;
	scanf("%d",&A);
	scanf("%d",&B);
	scanf("%d",&C);
	if(A+B+C<=17){
		printf("YES\n");
	}else
	{
		printf("NO\n");
	}
	system("pause");
	return 0;
}


Measured memory_bytes: 504
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  int N;
  cin >> N;
  cout << N*N*N << endl;
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<vector>
#include<algorithm>
#include<utility>
#include<numeric>
#include<iostream>
#include<array>
#include<string>
#include<sstream>
#include<stack>
#include<queue>
#include<list>
#define _USE_MATH_DEFINES

#include<math.h>
#include<unordered_map>

#define min(a,b) (a)>(b)?(b):(a)
#define max(a,b) (a)>(b)?(a):(b)

using namespace std;

class  OwnList
{
public:
	int data[2100000];
	int head;
	int end;
public:
	OwnList()
	{
		head = 2000000;
		end = 2000000;
	}
	void Insert(int x)
	{
		head--;
		data[head] = x;
	}

	void Delete(int x)
	{
		int tempIndex = end;
		for (int i = head; i < end; i++)
		{
			if (data[i] == x)
			{
				tempIndex = i;
				break;
			}
		}
		if (tempIndex != end)
		{
			while(true)
			{
				if (tempIndex == head)
				{
					break;
				}
				data[tempIndex] = data[tempIndex - 1];
				tempIndex--;
			}
			head++;
		}
	}

	void DeleteHead()
	{
		head++;
	}

	void DeleteEnd()
	{
		end--;
	}

	void Disp()
	{
		for (int i = head; i < end; i++)
		{
			cout << data[i];
			if (i < (end - 1))
			{
				cout << " ";
			}
		}
		cout << endl;
	}
};

OwnList l;

int main()
{
	int n;

	cin >> n;

	char command[32];
	
	for (int i = 0; i < n; i++)
	{
		scanf("%s", command);

		if (command[6] == '\0')
		{
			if (command[0] == 'i')
			{
				int value;
				cin >> value;
				l.Insert(value);
			}
			else if (command[0] == 'd')
			{
				int value;
				cin >> value;
				l.Delete(value);
			}
		}
		else if (command[6] == 'F')
		{
			l.DeleteHead();
		}
		else if (command[6] == 'L')
		{
			l.DeleteEnd();
		}
	}

	int i = 0;
	l.Disp();
	return 0;
}

Measured memory_bytes: 7064