akhauriyash/Code-Regression huggingface dataset:
/* Author rumoisen */
/* created 2018/10/13 */

#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <iomanip>
#include <numeric>
#include<iostream>
#include <algorithm>
 
using namespace std;
 
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define INF (ll)1e18
#define MOD (ll)1e9 + 7
#define pb push_back

void no(){cout<<"No"<<endl;exit(0);}
void yes(){cout<<"Yes"<<endl;exit(0);}
void No(){cout<<"NO"<<endl;exit(0);}
void Yes(){cout<<"YES"<<endl;exit(0);}

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

using namespace std;

int main()
{
    string s;
    cin>>s;
    int cntn=0,cntw=0,cnts=0,cnte=0;
    for(int i=0;i<s.size();i++){
        if(s[i]=='N') cntn+=1;
        if(s[i]=='S') cnts+=1;
        if(s[i]=='E') cnte+=1;
        if(s[i]=='W') cntw+=1;
    }
    if((cntn*cnts==0&&(cntn+cnts)!=0)||(cnte*cntw==0&&(cntw+cnte)!=0)) no();
    else yes();
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void) {

   uint64_t a,b;
   double ans;
   cin >>a>>b;
   ans=a+b;
   ans/=2;
   if(ceil(ans) != floor(ans)){
     cout<<"IMPOSSIBLE"<<endl;
   }else{
     cout<<(a+b)/2<<endl;
   }



   return 0;
 }


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

int main() {
    long long N;
    cin >> N;
    vector<long long> H(N);
    for (long long i = 0; i < N; i++){
        cin >> H[i];
    }

    string ans = "Yes";
    for (long long i = 1; i < N; i++){
        if (H[i-1] < H[i]){
            H[i] -= 1;
        }
    }

    for (long long i = 0; i < N -1; i++){
        if (H[i] > H[i+1]){
            ans = "No";
            break;
        }
    }

    cout << ans << endl;

}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ft first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;
static const ll INF=1e18;
static const ll MAX=1e5+7;
static const ll MOD=1e9+7;


int main(void) {
    ll X, Y, Z, K;
    cin >> X >> Y >> Z >> K;
    ll i, j, k;
    vector<ll> a(X), b(Y), c(Z);
    
    for(i=0; i<X; i++) cin >> a[i];
    for(i=0; i<Y; i++) cin >> b[i];
    for(i=0; i<Z; i++) cin >> c[i];
    
    vector<ll> ab;
    for(i=0; i<X; i++)
        for(j=0; j<Y; j++)
            ab.pb(a[i]+b[j]);
    sort(ab.rbegin(), ab.rend());
    
    vector<ll> ans;
    for(i=0; i<min(K, X*Y); i++)
        for(j=0; j<Z; j++)
            ans.pb(ab[i]+c[j]);
    sort(ans.rbegin(), ans.rend());
    
    for(i=0; i<min(K, X*Y*Z); i++) pt(ans[i]);
    
}


Measured memory_bytes: 42984
s=int(input())
def f(i):
    if i%2==0:
        return i//2
    else:
        return 3*i+1
a=[]
a.append(s)
for i in range(1,pow(10,7)):
    b=f(a[i-1])
    if b in a:
        print(i+1)
        break
    a.append(b)

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

int main()
{
	int h, w;
	cin >> h >> w;
	int n;
	cin >> n;
	vector<pair<int,int>> av(n);
	for (int i = 0; i < n; ++i ) {
		av[i].first = i + 1;
		cin >> av[i].second;
	}

	sort(av.begin(), av.end(), [](const pair<int, int>& a, const pair<int, int>& b){
		return a.second > b.second;
	});

	vector<int> temp(w);
	vector<vector<int>> ret(h, temp);
	int ch = 0;
	int cw = 0;
	bool right = true;
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < av[i].second; ++j) {
			ret[ch][cw] = av[i].first;
			if (right) {
				++cw;
				if (cw == w) {
					++ch;
					cw = w - 1;
					right = false;
				}
			}
			else {
				--cw;
				if (cw == -1) {
					++ch;
					cw = 0;
					right = true;
				}
			}
		}
	}

	for (int i = 0; i < h; ++i) {
		for (int j = 0; j < w; ++j) {
			cout << ret[i][j] << " ";
		}
		cout << endl;
	}

	return 0;
}

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

using namespace std;
int L,n,m,sl,T;
int main()
{
  
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin>>L;
    for (int i=0;i<20;++i) if ((L>>i)&1) {n=i+1;sl++;}
    sl--;m=(n-1)*2+sl;
    cout<<n<<' '<<m<<'\n';
    for (int i=1;i<n;++i) {cout<<i<<' '<<i+1<<' '<<0<<'\n';
                           cout<<i<<' '<<i+1<<' '<<(1<<(i-1))<<'\n';
    }
    for (int i=19;i>=0;--i)
    if ((L>>i)&1)
    {

        if (i+1==n) {T=T+(1<<i);continue;}
        cout<<i+1<<' '<<n<<' '<<T<<'\n';
        T=T+(1<<i);
    }

    return 0;
}


Measured memory_bytes: 256
X, N = map(int, input().split())
P = list(map(int, input().split()))

P.sort()
ans = 10000000
for i in range(-101, 102):
  if not i in P:
    ans = min(ans, abs(i-X))

if not X-ans in P:
  print(X-ans)
else:
  print(X+ans)


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

#define ll long long
#define deb(x) cerr << #x << ":" << x << "\n"
#define all(x) x.begin(),x.end()
#define sz(x) x.size()

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

void solve()
{
	int a,b,c,k;
	cin>>a>>b>>c>>k;
	int cnt=0;
	while(b<=a){
		b*=2;
		++cnt;
	}
	while(c<=b){
		c*=2;
		++cnt;
	}
	if(cnt<=k)cout<<"Yes\n";
	else cout<<"No\n";
}

int main()
{

    ios::sync_with_stdio(0);
    cin.tie(0);
    int t = 1;
    // cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define ll long long

using namespace std;

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

	ll a[n];
	for(int i=0;i<n;i++)
		cin >> a[i];

	sort(a, a+n);

	ll ok = 0;
	for(int i=0;i<n-k;i++)
		ok += a[i];

	cout << ok << "\n";
}

Measured memory_bytes: 1792
#include <iostream>
 
using namespace std;
 
int main()
{
    int a,b,c,d;
  cin>>a;
  cin>>b;
  cin>>c;
  cin>>d;
  int i=0;
  while(a>0&&c>0){
    if(i%2==0){
      c=c-b;
    }
    else{
      a=a-d;
    }
    i++;
   }
    if(a>0){
      cout<<"Yes"<<endl;
    }
  else{
    cout<<"No"<<endl;
  }
    return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
int sum(int n)
{
    int cnt = 0;
    while(n)
    {
        cnt += n % 10;
        n /= 10;
    }
    return cnt;
}
int main()
{
    ll n;
    cin >> n;
    if(n % sum(n) == 0)
    {
        cout << "Yes";
        return 0;
    }
    cout << "No";
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"os"
)

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	var n int
	var a [][]int
	fmt.Fscan(fp, &n)
	bits := 1 << uint(n)
	dp := make([]int, bits)
	dp[0] = 1

	for i := 0; i < n; i++ {
		a = append(a, make([]int, n))
		for j := 0; j < n; j++ {
			fmt.Fscan(fp, &a[i][j])
		}
	}

	for i := 0; i < bits; i++ {
		c := 0
		for cnt := 0; cnt < n; cnt++ {
			if (i>>uint(cnt))&1 == 1 {
				c++
			}
		}
		for j := 0; j < n; j++ {
			if (i>>uint(j))&1 == 0 && a[c][j] == 1 {
				dp[i|1<<uint(j)] += dp[i]
				dp[i|1<<uint(j)] %= 1000000007
			}
		}
	}

	fmt.Println(dp[bits-1])
}

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

int main() {
  int a, b;
  cin >> a >> b;
  vector<string> vec;
  string _a = "";
  string _b = "";
  for(int i=0;i<b;i++) {
    _a += to_string(a);
  }
  for(int i=0;i<a;i++) {
    _b += to_string(b);
  }
  vec.push_back(_a);
  vec.push_back(_b);
  sort(vec.begin(), vec.end());
  cout << vec.at(0) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,a,b) for (int i = (a); i < (b); i++ )
typedef pair<int,int> P;
typedef long long ll;
const int INF = 100000000;
const double PI=3.14159265358979323846;

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

    int A[N+2];

    rep(i,1,N+1) {
        cin >> A[i];
    }
    A[0] = 0;
    A[N+1] = 0;

    ll c = 0;
    rep(i,1,N+2) {
        c += max(A[i]-A[i-1],A[i-1]-A[i]);
    }

    rep(i,1,N+1) {
        if ((A[i]>A[i-1] && A[i+1]>A[i])||(A[i]<A[i-1] && A[i+1]<A[i])) {
            cout << c << endl;
        }
        else {
            ll tmp = min((max(A[i]-A[i-1],A[i-1]-A[i])),(max(A[i+1]-A[i],A[i]-A[i+1])))*2;
            cout << c-tmp << endl;
        }
    }
}





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

int main(){
	int i,ttt;
  	
  	string a;
  	i = 0;
 	do{
    	cin >> a[i];
      	ttt++;
      	i++;
      
    }while(a[i-1] != 0);
  
  
  	cout << a[0]<< ttt-3 << a[i-2] <<endl;
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define all(in) in.begin(), in.end()
#define FIO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef pair<int, int> PII;

int main(){
    FIO;
    ll l, r;
    cin >> l >> r;
    vector<ll> v;
    if(r - l >= 2019){
        cout << 0 << endl;
        return 0;
    }
    for(ll i = l ; i <= r ; i++){
        v.push_back(i);
    }
    ll n = v.size();
    ll ans = INT_MAX;
    for(ll i = 0 ; i < n ; i++){
        for(ll j = i+1 ; j < n ; j++){
            ll x = v[i] * v[j];
            x %= 2019;
            ans = min(ans, x);
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
/* clang-format on */

int main() {
  int N;
  while (cin >> N) {
    vector<ll> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    sort(A.begin(), A.end());
    deque<ll> B;
    int l = 0, r = N - 1;
    while (l <= r) {
      if (l != r) {
        if (B.empty()) {
          B.push_back(A[l]);
          B.push_back(A[r]);
        } else {
          ll a = abs(A[l] - B.front()) + abs(A[r] - B.back());
          ll b = abs(A[r] - B.front()) + abs(A[l] - B.back());
          if (a > b) {
            B.push_front(A[l]);
            B.push_back(A[r]);
          } else {
            B.push_front(A[r]);
            B.push_back(A[l]);
          }
        }
      } else {
        ll a = abs(A[l] - B.front());
        ll b = abs(A[l] - B.back());
        if (a > b) {
          B.push_front(A[l]);
        } else {
          B.push_back(A[l]);
        }
      }
      ++l;
      --r;
    }
    ll res = 0;
    for (int i = 1; i < N; i++) res += abs(B[i] - B[i - 1]);
    cout << res << endl;
  }
  return 0;
}


Measured memory_bytes: 1920
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
      
        int result = Math.max(a+b, Math.max(a-b, a*b));

        System.out.println(result);
    }
}


Measured memory_bytes: 35564
L, R = map( int, input().split() )
result = 2019

for i in range(L, R+1):
    for j in range(i+1,R+1):
        tmp = (i*j) % 2019
        if tmp < result:
            result = tmp
        if result == 0:
            break;
    if result == 0:
        break;

print(result)

Measured memory_bytes: 3060
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>
#include <time.h>
using namespace std;
#define int long long
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define l1 list[index]
#define l2 list[index - 1]
#define l3 list[index + 1]
#define iif(i,j) ((i<0 && j<0) || (i>0 && j>0)) ? true : false 
typedef long long ll;
typedef pair<int, int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint, int> P1;
typedef pair<int, pint> P2;
typedef pair<pint, pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007;
const ll INF = 1e18;
int ca[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };




signed main() {
	int n, h, w;
	//vector<int>list(200005, 0);
	int list2[500005];
	int list[300005];
	static int kijyun = 250000;
	int right = 1, left = 1;

	memset(list2, -1, sizeof(list2));


	cin >> n;

	for (int i = 0; i < n; i++) {
			int num;
			cin >> num;
			list[i] = num;
	}

	int num = n;

	list2[kijyun] = list[n - num];
	num--;


	while (num>0)
	{
		if (num % 2 == 0) {
			list2[kijyun + right] = list[n - num];
			right++;
		}
		else {
			list2[kijyun - left] = list[n - num];
			left++;
		}

		num--;
	}

	int cnt = 0;

	for (int i = 0; i < 450000; i++) {
		if (list2[i] != -1) {
			cout << list2[i];
			cnt++;
			if (cnt != n) {
				cout << " ";
			}
		}
	}
	cout << endl;
	

	//vector<int>list2;

	//for (int i = 0; i < n; i++) {
	//	int num;
	//	cin >> num;

	//	if (i % 2 == 1) {
	//		//list2.insert(list2.begin(), list[i]);
	//		list2.insert(list2.begin(), num);
	//	}
	//	else {
	//		//list2.push_back(list[i]);
	//		list2.push_back(num);
	//	}
	//}

	//if (n % 2 == 0) {
	//	for (int i = 0; i < n; i++) {
	//		cout << list2[i];
	//		if (i != n - 1) {
	//			cout << " ";
	//		}
	//	}
	//	cout << endl;
	//}
	//else {
	//	for (int i = n - 1; i >= 0; i--) {
	//		cout << list2[i];
	//		if (i >= 1) {
	//			cout << " ";
	//		}
	//	}
	//	cout << endl;
	//}







	return 0;
}

Measured memory_bytes: 8448
def main():
    N = int(input())
    H = list(map(int, input().split()))
    dp = [float('inf')] * (N + 5)
    dp[0] = 0
    for i in range(N):
        if i + 1 <= N - 1:
            dp[i+1] = min(dp[i+1], dp[i] + abs(H[i+1] - H[i]))
        if i + 2 <= N - 1:
            dp[i+2] = min(dp[i+2], dp[i] + abs(H[i+2] - H[i]))
    
    print(dp[N-1])

    

if __name__ == "__main__":
    main()

Measured memory_bytes: 52208
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
int main() {
    int n;
    cin >> n;
    int h[n + 1];
    for (int i = 1; i <= n; i++) {
        cin >> h[i];
    }
    ll m[n + 1];
    m[1] = 0;
    m[2] = abs(h[2] - h[1]);
    for (int i = 3; i <= n; i++) {
        ll x1 = m[i - 2] + abs(h[i] - h[i - 2]);
        ll x2 = m[i - 1] + abs(h[i] - h[i - 1]);
        m[i] = min(x1, x2);
    }
    cout << m[n] << endl;
    return 0;
}

Measured memory_bytes: 4808
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
#define eb emplace_back
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll MOD = 1e9 + 7;
template <class T>
void chmin(T &a, T b) { a = min(a, b); }
template <class T>
void chmax(T &a, T b) { a = max(a, b); }
void ok() { cerr << "ok" << endl; }
int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    int n, m;
    cin >> n >> m;
    cout << n * (n - 1) / 2 + m * (m - 1) / 2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
const ll mod=1000000007;
const ll BIG=1e15;

vector<ll> d[8];
int main(){
    int N,M; cin>>N>>M;
    for(int j=0;j<N;j++){
        ll x,y,z;
        cin>>x>>y>>z;
        vector<ll> k(8,0);
        for(int i=0;i<8;i++){
            if(i<4) k.at(i)+=x;
            else k.at(i)-=x;
            if(i%2==0) k.at(i)+=y;
            else k.at(i)-=y;
            if((i%4)<2) k.at(i)+=z;
            else k.at(i)-=z;
        }
        for(int i=0;i<8;i++) d[i].push_back(k.at(i));
    }

    for(int i=0;i<8;i++){
        sort(d[i].begin(),d[i].end());
        reverse(d[i].begin(),d[i].end());
    }

    ll ans=0;
    for(int i=0;i<8;i++){
        ll kari=0;
        for(int j=0;j<M;j++) kari+=d[i].at(j);
        ans=max(kari,ans);
    }
    cout<<ans<<endl;


}

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

int main(){
    int n;
    cin>>n;
    vector<int> vec(n);
    set<int> mochi;
    for(int i=0; i<n; i++){
        cin>>vec.at(i);
        mochi.insert(vec.at(i));
    }
    cout<<mochi.size()<<endl;
}


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

int main(){
  int N;
  cin>>N;
  vector<int>h(N);
  
  for(int i=0;i<N;i++){
    cin>>h[i];
  }
  int mini=1000;
  int minpos=0;
  int ans=0;
  int i=0;
  while(i<N){
    mini=1000;
    minpos=0;
    if(h[i]==0){
      i++;
      continue;
    }
    int j;
    for(j=0;j<N-i;j++){
      if(h[i+j]==0) break;
      if(mini>=h[i+j]){
        mini=h[i+j];
        minpos=j;
      }
    }
    for(int k=0;k<j;k++){
      h[i+k]-=mini;
    }
    ans+=mini;
    //cout<<i<<" , "<<mini<<endl;
    if(h[i]==0) i++;
  }
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 256
n = int(input())
h = list(map(int, input().split()))
dp = [float('Inf')] * n
dp[0] = 0
for i in range(1, n):
    dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]))
    if i > 1:
        dp[i] = min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]))
print(dp[n - 1])

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

int main(void){
    int N;
    int count[4];
    cin >> N;
    string judge;
    for(int i=0; i<N; i++){
        string t;
        cin >> t;
        judge+=t[0];
    }

    for(int i=0; i<4; i++){
        count[i] = 0;
    }

    for(int i=0; i<N; i++){
        if(judge[i]=='A')
            count[0]++;
        else if(judge[i]=='W')
            count[1]++;
        else if(judge[i]=='T')
            count[2]++;
        else{
            count[3]++;
        }
    }

    cout << "AC x ";
    cout << count[0] << endl;
    cout << "WA x ";
    cout << count[1] << endl;
    cout << "TLE x ";
    cout << count[2] << endl;
    cout << "RE x ";
    cout << count[3] << endl;

    return 0;
}


Measured memory_bytes: 3756
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin >> n;n--;
	vector<int> a(n);
	for(int & v : a) cin >> v;
	int ans = 0;
	for(int i = 0; i < n - 1; i++) ans += min(a[i], a[i + 1]);
	ans += a[0];
	ans += a[n - 1];
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <queue>
using namespace std;

int n, k;
int c[5000], r[5000];
vector<int> g[5000];

typedef pair<int, int> P;
vector<int> v[5000];
int INF = 1e9+7;
int d[5000];

void bfs(int x){
	queue<P> q;
	q.push(P(0, x));
	int w[5000];
	fill(w, w+n, INF);
	w[x] = 0;
	while(!q.empty()){
		P p = q.front(); q.pop();
		for(int i=0; i<g[p.second].size(); ++i){
			if(p.first+1 < w[g[p.second][i]]){
				w[g[p.second][i]] = p.first+1;
				if(p.first+1 < r[x]) q.push(P(p.first+1, g[p.second][i]));
			}
		}
	}
/*	if(x == 2){
		for(int i=0; i<n; ++i){
			printf("%d\n", w[i]);
		}
	}
*/	for(int i=0; i<n; ++i){
		if(w[i] != INF && i != x) v[x].push_back(i);
	}
}

void dijkstra(){
	fill(d, d+n, INF);
	d[0] = 0;
	priority_queue<P, vector<P>, greater<P> > q;
	q.push(P(0, 0));
	while(!q.empty()){
		P p = q.top(); q.pop();
		int ve = p.second;
		if(d[ve] < p.first) continue;
		for(int i=0; i<v[ve].size(); i++){
			if(d[v[ve][i]] > d[ve] + c[ve]){
				d[v[ve][i]] = d[ve] + c[ve];
				q.push(P(d[v[ve][i]], v[ve][i]));
			}
		}
	}
}

int main(){
	scanf("%d %d", &n, &k);
	for(int i=0; i<n; ++i) scanf("%d %d", &c[i], &r[i]);

	for(int i=0; i<k; ++i){
		int a, b;
		scanf("%d %d", &a, &b);
		g[a-1].push_back(b-1);
		g[b-1].push_back(a-1);
	}
/*
	for(int i=0; i<n; ++i){
		printf("%d\n", i);
		for(int j=0; j<g[i].size(); j++){
			printf("%d ", g[i][j]);
		}
		printf("\n");
	}
*/
	for(int i=0; i<n; ++i) bfs(i);
/*
	for(int i=0; i<n; ++i){
		printf("\n%d %d\n", i+1, r[i]);
		for(int j=0; j<v[i].size(); j++){
			printf("%d\n", v[i][j]+1);
		}
	}
*/
	dijkstra();
	printf("%d\n", d[n-1]);
}

Measured memory_bytes: 70052
#bit探索でできるらしい
#URL:https://qiita.com/gogotealove/items/11f9e83218926211083a
n,m,x=map(int,input().split())
item=[list(map(int,input().split()))for i in range(n)]#金、アルゴリズムUp数
book=[i for i in range(n)]#本Nを表す
bag=[]#条件を満たす本の買い方
for i in range(2**n):#すべて調べる
    temp=[]#買う本
    job=[0]*m#理解度
    for s in range(n):#全桁を調べる
        if (i>>s)&1:#買うのであれば
            temp.append(s)#買う本を追加
            for y in range(m):
                job[y]+=item[s][y+1]#理解度を足す
    for s in range(len(job)):
        if job[s]<x:#もし、理解度がX未満であればbreak
            break
    else:#理解度がすべてX以上ならば
        money=0
        for s in temp:#合計金額を算出
            money+=item[s][0]
        bag.append(money)
#買う組み合わせが1以上なければ-1を出力
print(min(bag) if len(bag)>=1 else -1)

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

int cnt_b[3];

int main() {
  int n;
  cin>>n;
  int b[3];
  int a[100005];
  for (int i=0; i<n; i++) cin>>a[i];

  sort(a,a+n);
  int cnt=0;
  b[0]=a[0];
  cnt_b[0]=1;
  for (int i=1; i<n; i++) {
    if (a[i]!=b[cnt]) {
      cnt++;
      if (cnt>2) {
	cout<<"No"<<endl;
	return 0;
      }
      b[cnt]=a[i];
    }
    cnt_b[cnt]++;
  }

  if (cnt==0) {
    if (b[0]==0) {
      cout<<"Yes"<<endl;
      return 0;
    }
    else {
      cout<<"No"<<endl;
      return 0;
    }
  }
  if (n%3) {
    cout<<"No"<<endl;
    return 0;
  }
  if (cnt==1) {
    if (b[0]!=0||cnt_b[0]!=n/3) {
      cout<<"No"<<endl;
      return 0;
    }
    cout<<"Yes"<<endl;
    return 0;
  }
  if (cnt_b[0]!=n/3||cnt_b[1]!=n/3) {
    cout<<"No"<<endl;
    return 0;
  }
  while (!(b[0]==0&&b[1]==0&&b[2]==0)) {
    if (!(b[0]%2+b[1]%2+b[2]%2==2||b[0]%2+b[1]%2+b[2]%2==0)) {
      cout<<"No"<<endl;
      return 0;
    }
    b[0]/=2;
    b[1]/=2;
    b[2]/=2;
  }
  cout<<"Yes"<<endl;
  return 0;
}

Measured memory_bytes: 640
/*
Author- Aasav Badera
Time- Sun Apr 12 17:57:45 2020
*/
#include<bits/stdc++.h> 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}
// -------------------Standard Traversal Moves---------------------
// vi fx = {1 ,-1 ,0, 0}, fy = {0, 0, -1, 1};
// vi fx = {2, -2, 2, -2,  1, -1, 1, -1}, fy = {1, 1, -1, -1, 2, 2, -2, -2};
// vi fx = {1, 1, 1, -1, -1 , -1, 0, 0}, fy = {1, -1, 0, 1, -1, 0, 1, -1};
// ----------------------------------------------------------------

#define ll                 long long    
#define int                long long                        
#define pb                 push_back                                                     
#define mii                map<ll ,ll >
#define rep(i, a, b)       for(ll  i=a;i<b;i++)
#define dbg(args...)       { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define pii                pair<ll ,ll >
#define ppb                pop_back
#define vi                 vector<ll >
#define vii                vector<pair<ll , ll >>
#define si                 set <ll>
#define hell               1000000007
// #define hell               (ll)998244353
#define all(a)             (a).begin(),(a).end()
#define sz(x)              (ll )x.size()
#define mp                 make_pair
#define yes                cout << "YES" << endl
#define no                 cout << "NO" << endl
#define inf                1e18L+1
#define endl               '\n' 
#define N                  200005
ll n, a[N];
ll dp[N][4][2];
bool vis[N][4][2];
ll go(ll pos, ll cur, ll last)
{
    if(cur < -1)return -inf;
    if(pos == n)return 0;
    if(vis[pos][cur+2][last])return dp[pos][cur+2][last];
    vis[pos][cur + 2][last] = 1;
    ll &ans = dp[pos][cur + 2][last];
    ans = go(pos+1, cur-1, 0);
    if(last == 0)
    {
        ans = max(ans, go(pos+1, cur+1, 1) + a[pos]);
    }
    return ans;
}
int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    // #ifndef ONLINE_JUDGE
    // // for getting input from input.txt
    // freopen("input.txt", "r", stdin);
    // // for writing output to output.txt
    // freopen("output.txt", "w", stdout);
    // #endif
    ll tests = 1;
    // cin >> tests;
    while(tests--)
    {
        cin >> n;
        rep( i,0, n)cin >> a[i];
        cout << go(0, n%2, 0) << endl;
    }
    return 0;
}



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

int main(){
  int move_row[8] = {0, -1, -1, -1, 0, 1, 1, 1}; // left>left up>up>...
  int move_col[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
  int H, W;
  cin >> H >> W;
  string Grid[55], out[55];
  for(int i=0;i<H;++i){
    cin >> Grid[i];
    out[i] = Grid[i];
  }
  
  for(int i=0;i<H;++i){
    for(int j=0;j<W;++j){
      if(Grid[i][j] == '.'){
        int count = 0;
        int target_row;
        int target_col;
        for(int k=0;k<8;++k){
          bool flag = true;
          target_row = i + move_row[k];
          target_col = j + move_col[k];
          if(target_row < 0 || target_col <0) flag = false;
          else if(target_row > H || target_col > W) flag = false;
          if(flag){
            if(Grid[target_row][target_col] == '#'){
              count++;
            }
          }
        }
        char n = '0' + count;
        out[i][j] = n;
      }
    }
  }
  
  for(int i=0;i<H;++i) cout << out[i] << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
 int H,W;
 cin>>H>>W;
 char a[H][W];
 for(int i=0; i< H; i++)
 {
   for(int j=0;j<W;j++)
    cin>>a[i][j];
 }
 for(int i=-1; i< H+1; i++)
 {
   
   if(i!=-1 && i!=H)
   {
      for(int j=-1;j<W+1;j++)
       {
        if(j!=-1 && j!= W)
         cout<<a[i][j];
        else 
         cout<<"#";
       }
   }
   else
    {
      for(int j=-1;j<W+1;j++)
       cout<<"#";
    }
    
   cout<<"\n";
 }
 
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define full(a) a.begin(),a.end()
#define rfull(a) a.rbegin(),a.rend()

using namespace std;
const double pi=acos(-1.0);
const double pii=2*pi;
const double eps=1e-6;
const long long MOD=1e9+7;

void solve(){
    int n; long long d;
    cin>>n>>d;
    d*=d;
    int ans=0;
    for(int i=0;i<n;i++){
        long long x,y;
        cin>>x>>y;
        if(x*x+y*y<=d) ans++;
    }
    cout<<ans<<'\n';
}

int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(NULL);
    std::cout.tie(NULL);

    solve();
    return 0;
}

Measured memory_bytes: 3656
n=int(input())
a=list(map(int,input().split(' ')))
b=list(map(int,input().split(' ')))
c=list(map(int,input().split(' ')))
a=[0]+sorted(a)+[float('inf')]
c=[0]+sorted(c)+[float('inf')]


def meguru_a(bi):
    ng=n+1 ; ok=0
    while (abs(ok - ng) > 1): 
        mid = (ok + ng) // 2
        if a[mid] < bi :
            ok = mid
        else:
            ng = mid
    return ok

def meguru_c(bi):
    ng=-1 ; ok=n
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if bi < c[mid+1]:
            ok = mid
        else:
            ng = mid
    return ok

altar=0

for bi in b:
    s=meguru_a(bi)*(n - meguru_c(bi))
    altar+=s
print(altar)

Measured memory_bytes: 24180
#include <bits/stdc++.h> 
using namespace std;
#define rep(i, N) for(int i=0; i<N; i++)
typedef long long ll;
#define dump(x) cerr<<#x<<"="<<x<<endl
using P = pair<int, int>;
 
int main() {
    ll n, a, b; cin >> n >> a >> b;
    vector<ll> h(n);
    rep(i, n) cin >> h.at(i);
 
    sort(h.begin(), h.end());
 
    ll l, r;
 
    l = -1;
    r = (ll)h.at(n-1)/b + 2LL;
    while(abs(r-l)>1){
        ll mid = (l+r)/2LL;
 
        ll tmp = 0;
        for(int i=0; i<n; i++){
            if(h.at(i)-b*mid<=0) continue;
            else{
                tmp += (ll)((h.at(i)-b*mid)+(a-b)-1LL)/(ll)(a-b);
            }
        }
 
        if(tmp>mid) l = mid;
        else r = mid;
    }
 
    cout << r << endl;
 
    return 0;
}

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

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

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;
#define DEBUG freopen("in.txt", "r", stdin);

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

string a, b, c;
int i, j, k;
int main() {
    cin >> a >> b >> c;
    char cur = 'a';
    while (1) {
        if (cur == 'a') {
            if (i == a.length()) {
                cout << "A" << endl;
                return 0;
            }
            cur = a[i++];
        } else if (cur == 'b') {
            if (j == b.length()) {
                cout << "B" << endl;
                return 0;
            }
            cur = b[j++];
        } else {
            if (k == c.length()) {
                cout << "C" << endl;
                return 0;
            }
            cur = c[k++];
        }
    }
    return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  
  int ABC_num = 0;
  for (int A = 1; A < N; A++) {
    ABC_num += (N-1)/A;
  }
  
  cout << ABC_num << endl;
}


Measured memory_bytes: 3628
from fractions import gcd
n,m = map(int,input().split())
A = list(map(int,input().split()))

l = 1
cnt = -1
for a in A:
    l = l*a//gcd(l,a)
    i = 0
    while a%2 == 0:
        a = a//2
        i += 1
    if cnt == -1:
        cnt = i
    elif cnt != i:
        print(0)
        exit(0)

ans = 1 + (m - l//2)//l
print(ans)


Measured memory_bytes: 16324
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int maxn=1000005;
int a[maxn],b[maxn],opt[maxn],limit[maxn],x[maxn],y[maxn],L,R,n,m;
int check(int mid)
{
//	cout<<mid<<" "<<a[mid]<<" ";
	int now=a[mid];
	for(int i=1;i<=m;i++)
	{
		if(opt[i]==1)
		{
			if(now>=limit[i])now=(now+x[i])*y[i];
		}
		else if(now<=limit[i])now=(now-x[i])/y[i];	
	}
	
//	cout<<now<<endl;
	return now;
}
signed main()
{
	cin>>n>>m>>L>>R;
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=1;i<=m;i++)cin>>opt[i]>>limit[i]>>x[i]>>y[i];
	sort(a+1,a+1+n);
	int l=1,r=n,ans1=0;
	while(l<=r)
	{
		int mid=(l+r)/2;
		if(check(mid)<=R)ans1=mid,l=mid+1;
		else r=mid-1; 
	} 
//	cout<<ans1<<endl;
	l=1,r=n;int ans2=n+1;
	while(l<=r)
	{
		int mid=(l+r)/2;
		if(check(mid)>=L)ans2=mid,r=mid-1;
		else l=mid+1; 
	} //cout<<ans2<<endl;
	cout<<ans1-ans2+1<<endl;
	
}
/*
3 3 3 10
1 -2 3
1 2 2 3
2 20 1 3
2 1 20 5
首先那些不构成约束的边直接就是2^k/2，随便取，然后有一半的概率是不合法的
对于有约束的边就看下约束
每次枚举一个点，然后开始检查所有边 
 
 */


Measured memory_bytes: 10764
#include <iostream>
#include <random>
#include <vector>
#include <array>
#include <string>
#include <cstdlib>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

ull powmod(ull  a,ull b, ull mod) {
  ull res=1;
  for(; b; b >>= 1){
    if(b & 1){
      res = res * a % mod;
    }
    a = a * a % mod;
  }
  return res;
}

bool check(string s){
  int h = 0;
  int t = s.length() - 1;
  while (h <= t){
    if (s[h] != s[t]){
      return false;
    }
    h++; t--;
  }
  return true;
}

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

  string a, b;
  cin >> a;
  cin >> b;

  int a_i = stoi(a);
  int b_i = stoi(b);
  int counter = 0;
  for(int i = a_i; i <= b_i; i ++){
    if (check(to_string(i))){
      counter ++;
    }
  }
  cout << counter << "\n";
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
	int n;
	cin >> n;
	int f[50] = {1, 1};
	for (int i = 2; i <= n; ++i)
		f[i] = f[i - 1] + f[i - 2];
	cout << f[n] << endl;
}

Measured memory_bytes: 3088
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <queue>
#include <sstream>
#include <fstream>

using namespace std;

int main()
{
	int N, K;
	cin >> N >> K;
	int Y, X;
	cin >> X >> Y;
	int s = 0;
	for (int i = 0; i < N; ++i) s += (i < K ? X : Y);
	cout << s << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#include <set>
#include <map>
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout << fixed << setprecision(20);
#define rep(i,n) for (int i=0; i<n;++i)
#define ALL(a)  (a).begin(),(a).end()
#define PI 3.14159265358979
typedef long long ll;
using namespace std;
const ll MOD = 1e9+7LL;
const int INF = 2e9;
int X, Y;

int a[1000] = {300000, 200000, 100000};
int main() {
  INCANT;
  cin >> X >> Y;
  if (X==1 && Y==1) {
    cout << 1000000 << "\n";
    return 0;
  }
  X--; Y--;
  cout << a[X]+a[Y] << "\n";
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define INF 10000000000
using namespace std;
using ll = long long;
int main()
{
    int n;
    cin >> n;
    ll ans = 0;
    map<char,ll> mp;
    rep(i,n){
        string s;
        cin >> s;
        mp[s[0]]++;
    }
    string str = "MARCH";
    rep(i,3){
        for (int j = i + 1;j <= 4;j++){
            for(int k = j + 1; k <= 5;k++){
                ans += mp[str[i]] * mp[str[j]] * mp[str[k]];
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long 
#define LL long long 
#define LD long double
#define PI 3.14159265358979323846
#define MOD ((LL)1e9+7)
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;




	
int32_t main()
{
	int n,ans=0,mx=0;cin>>n;
	for(int i=1;i<=n;i++)
	{
		int x;cin>>x;
		if(mx<=x)
		{
			ans++;
			mx=x;
		}
	}
	cout<<ans<<endl;
}
				
				   
	

	


Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

A, B = input().split()
A = int(A)
B100 = int(B.replace(".", ""))

ans100 = A * B100
print(ans100 // 100)





Measured memory_bytes: 10816
#include <stdio.h>
 
int main(void){
  int i,j,tmp;
  int moun[10];
  for (i=0;i<10;i++){
     scanf("%d",&moun[i]);
  }
  for (i=0;i<10;i++){
   for(j=i;j<10;j++){
     if(moun[i] < moun[j]){
       tmp = moun[j];
       moun[j] = moun[i];
       moun[i] = tmp;
     }
   }
  }
  printf("%d\n%d\n%d\n",moun[0],moun[1],moun[2]);
  return 0;
}

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

int main() {
#include <iostream>
using namespace std;
 
int n; cin >> n;
	
	for (int i = 1; i <= 9; i++)
	{
	    for (int j = 1; j <= 9; j++)
	    {
	        if (i * j == n)
	        {
	            cout << "Yes";
	            return 0;
	        }
	    }
	}
	
	cout << "No";
	
}

Measured memory_bytes: 256
#include <iostream>
 
using namespace std;
 
int main(){
  int W, H, x, y, r;
 
  cin >> W >> H >> x >> y >> r;
  if(x-r < 0 || x+r > W || y-r < 0 || y+r > H){
    cout << "No" << endl;
  }else{
    cout << "Yes" << endl;
  }
 
  return 0;
}

Measured memory_bytes: 3112
#include<bits/stdc++.h>
using namespace std;
int n; 
int main()
{
	cin>>n;
	if(n==1)
	{
		puts("Hello World");
	}
	else
	{
		int a,b;
		cin>>a>>b;
		cout<<a+b<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i=a; i<n; i++)
#define RREP(i, a, n) for(ll i=n-1; i>=a; i--)
typedef long long ll;
const ll mod =1e9+7;
const ll inf =1e18;
using namespace std;

string s;
int main() {
    cin>>s;

    int p1=10*(s[0]-'0') + (s[1]-'0');
    int p2=10*(s[2]-'0') + (s[3]-'0');

    if((p1>=1 && p1<=12) && (p2>=1 && p2<=12)){
        cout<<"AMBIGUOUS"<<endl;
    }
    else if((p1==0 || p1>12) && (p2>=1 && p2<=12)){
        cout<<"YYMM"<<endl;
    }
    else if((p1>=1 && p1<=12) && (p2==0 || p2>12)){
        cout<<"MMYY"<<endl;
    }
    else{
        cout<<"NA"<<endl;
    }
    return 0;
}

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

map<int,int>vis;
vector<int>v,vt,vk,r;
int n;
bool check()
{
  int i;
  for(i=0; i<n; i++)
  {
    if(vk[i]!=r[i])return false;
  }
  return true;
}

int fact(int n)
{
  int f=1,i;
  for(i=1; i<=n; i++)
  {
    f=f*i;
  }
  return f;
}

int main()
{
  int m, a, ok=0, res=0, flag=0,pos1=1,pos2=1, i;
  cin>>n;

  for(i=0; i<n; i++)
  {
    cin>>m;
    v.push_back(m);
  }
  for(i=0; i<n; i++)
  {
    cin>>m;
    vt.push_back(m);
  }
  for(i=1; i<=n; i++)
  {
    vk.push_back(i);
  }
 int f=fact(n);
  for(i=1;i<f;i++)
  {
    next_permutation(vk.begin(),vk.end());
    r=v;
    if(check()){
      pos1=i+1;
      flag++;
      r.clear();
    }
    r=vt;

    if(check()){
      pos2=i+1;
      flag++;
      r.clear();
    }
    if(flag==2)break;
  }
  cout<<abs(pos1-pos2)<<endl;

}


Measured memory_bytes: 764
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<map>
#include<queue>
#include<set>
#include<bitset>
#include<stdio.h>
#include<deque>
#include<iomanip>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
typedef long long ll;
 
int main()
{
   double t, k;
   cin >> t >> k;
   double ans = (double)t/k;
   cout << fixed << setprecision(10) << ans << endl;
}

Measured memory_bytes: 256
class Deck
  Suits = %w(S H C D)

  def initialize
    @cards = []
    Suits.each do |suit|
      (1..13).each do |rank|
        @cards << "#{suit} #{rank}"
      end
    end
  end

  def open
    puts @cards
  end

  def delete(suit, rank)
    @cards.delete("#{suit} #{rank}")
  end
end

deck = Deck.new

_ = gets
ARGF.each_line do |line|
  suit, num = line.split
  deck.delete(suit, num.to_i)
end

deck.open

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

int main(void){
  char S[3];
  int cnt = 0;
  bool ans = false;
  cin >> S;
  for(int i = 0; i < 3; i++){
    if(S[i] == 'R')
      ans = true;
  }
  for(int i = 0; i < 2; i++){
    if(S[i] == 'R' && S[i+1] == 'R')
      cnt++;
  }
  if(ans) cout << cnt + 1 << "\n";
  else cout << 0 << "\n";
  return 0;
}


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

using namespace std;

int mainB()
{
	string str1, str2;
	cin >> str1 >> str2;
	int k = stoi(str1);
	int x = stoi(str2);
	int minx = x - k + 1;
	int maxx = x + k - 1;

	for (int i = minx; i <= maxx; ++i)
	{
		cout << i;
		if (i < maxx)
			cout << ' ';
		else
			cout << endl;
	}
	return 0;
}

int main()
{
	return mainB();
}

Measured memory_bytes: 256
n = int(input())
s = list(input())
ruiseki = []
W = 0
for i in range(n):
    if s[i]=="W":
        W += 1
    ruiseki.append(W)

mn = 10**6
for i in range(n):
    if i==0:
        left_W = 0
        right_E = (n-1)-(ruiseki[n-1]-ruiseki[0])
    elif i==n-1:
        left_W = ruiseki[n-2]
        right_E = 0
    else:
        left_W = ruiseki[i-1]
        right_E = (n-(i+1))-(ruiseki[n-1]-ruiseki[i])
    
    ans = left_W + right_E
    mn = min(mn,ans)
print(mn)

Measured memory_bytes: 80188
#include <bits/stdc++.h>
#include <algorithm> 
#include<math.h>
#define rep(i,n) for (int i = 0; i < (n) ; ++i)
using namespace std;
using ll = long long ;
using P = pair<int, int> ;
#define PI 3.14159265358979323846264338327950
#define INF 1e18 

int main (){
    int n, m ;
    cin >> n >> m ;
    vector<vector<int>> rd (n) ;
    rep(i, m){
        int a, b ;
        cin >> a >> b ;
        a-- ;
        b-- ;
        rd[a].push_back(b) ;
        rd[b].push_back(a) ;
     }
     queue<int> que ;
     vector<int> p (n, -1) ;
     p[0] = 0 ;
     que.push(0) ;
     while(!que.empty()){
         int t = que.front() ;
         que.pop() ;
         int s = rd[t].size() ;
         rep(i, s){
             int f = rd[t][i] ;
             if(p[f] == -1){
                 que.push(f) ;
                 p[f] = t ;
            }
        }
    } 
    rep(i, n){
        if(p[i] == -1){
            cout << "No" << endl ;
            return 0 ;
        }
    }
    cout << "Yes" << endl ;
    rep(i, n){
        if(i != 0){
            cout << p[i] + 1<< endl ;
        }
    }
    
}

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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll a = 1;
    while (a * 2 <= N) {
        a *= 2;
    }
    cout << a << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#include <algorithm>
#include <bitset>
#include <complex>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#include <cassert>
#include <functional>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template<typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


int main() {
  int X, Y;

  cin >> X >> Y;

  for (int i = 0; i <= X; i++) {
    int j = X - i;

    if (i >= 0 && j >= 0 && i * 2 + j * 4 == Y) {
      cout << "Yes" << endl;
      return 0;
    }
  }

  cout << "No" << endl;

  return 0;
}


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

#ifdef NON_SUBMIT
#define TEST(n) (n)
#define tout cerr
#else
#define TEST(n) ((void)0)
#define tout cin
#endif

using namespace std;

const int MOD=1e9+7;
int A[2000], cnt[2001];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	TEST(freopen("input.txt","r",stdin));
	TEST(freopen("output.txt","w",stdout));
	TEST(freopen("debug.txt","w",stderr));
	int N, K, ans=0;
	cin>>N>>K;
	for(int i=0;i<N;i++) {
		cin>>A[i];
		cnt[A[i]]++;
	}
	for(int i=1;i<=2000;i++) cnt[i]+=cnt[i-1];
	for(int i=0;i<N;i++) {
		ans=(ans+(K*(K-1LL)/2)%MOD*cnt[A[i]-1])%MOD;
		for(int j=i+1;j<N;j++) if(A[i]>A[j]) ans=(ans+K)%MOD;
	}
	cout<<ans<<'\n';
	return 0;
}

Measured memory_bytes: 256
from sys import stdin


# A, B = [int(x) for x in stdin.readline().rstrip().split()]
# A,B = [int(x) for x in stdin.readline().rstrip().split()]
U = stdin.readline().rstrip().split()
# print(U[0][1])
if U[0][2]==U[0][3] and U[0][4]==U[0][5]:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 2940
program main
  implicit none
  integer*8 :: a, b, c
  read *, a, b, c
  if (c-a-b>0 .and. 4*a*b<(c-a-b)**2) then
    print '(a)', 'Yes'
  else
    print '(a)', 'No'
  end if
end program

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
using namespace std;

int main()
{
	char str[1001];

	while (1) {
		scanf("%s", str);
		if (str[0] == '0')break;
		int sum = 0;
		for (int i = 0; i < strlen(str); i++) {
			sum += (str[i] - '0');
		}
		printf("%d\n", sum);
	}
	return 0;
	
}

Measured memory_bytes: 2696
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <string.h>
#include <tuple>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef pair<int, int> pii;
typedef tuple<int, int, int> tupiii;
typedef tuple<ll, ll, ll> tuplll;

const int INTMAX = 2147483647;
const ll LLMAX = 9223372036854775807;
const int MOD = 1000000007;

template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
inline void swap(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
inline void swap(int& a, int& b) { a ^= b; b ^= a; a ^= b; }


typedef pair<int, ll> P;
typedef pair<ll, ll> pll;
int n;
ll c;
vector<P> toleft, toright;
vll val;
vll pos;

void init()
{
	cin >> n >> c;

	val.resize(n + 1, 0);
	pos.resize(n + 1, 0);
	REP1C(i, n) { cin >> pos[i] >> val[i]; }

	toleft.resize(n + 1);
	toright.resize(n + 1);
	toright[0] = toleft[0] = P(0, 0);
}


int main()
{
	init();
	ll best, tmp, lastpos;
	ll ans = 0;

	best = tmp = lastpos = 0LL;
	REP1C(i, n)
	{
		tmp += val[i] - pos[i] + lastpos;
		lastpos = pos[i];

		if (chmax(best, tmp))
			toright[i] = P(i, best);
		else
			toright[i] = toright[i - 1];
	}

	best = tmp = 0;
	for (int i = n; i >= 1; --i)
	{
		tmp += val[i];

		if (chmax(best, tmp - 2 * (c - pos[i])))
			toleft[i] = P(i, best);
		else
		{
			if (i == n)
				toleft[i] = P(0, 0);
			else
				toleft[i] = toleft[i + 1];
		}
	}

	for (int i = 1; i <= n; i++)
	{
		chmax(ans, toright[i].second);
		if (toright[i].first != n)
			chmax(ans, toright[i].second + toleft[toright[i].first + 1].second);
	}

	best = tmp = 0;
	REP1C(i, n)
	{
		tmp += val[i];
		if (chmax(best, tmp - 2 * pos[i]))
			toright[i] = P(i, best);
		else
			toright[i] = toright[i - 1];
	}

	best = tmp = 0;
	for (int i = n; i >= 1; --i)
	{
		tmp += val[i];

		if (chmax(best, tmp - (c - pos[i])))
			toleft[i] = P(i, best);
		else
		{
			if (i == n)
				toleft[i] = P(0, 0);
			else
				toleft[i] = toleft[i + 1];
		}
	}

	for (int i = 1; i <= n; i++)
	{
		chmax(ans, toleft[i].second);
		if (toleft[i].first != 0)
			chmax(ans, toleft[i].second + toright[toleft[i].first - 1].second);
	}

	cout << ans << endl;
}


Measured memory_bytes: 4992