akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

long long f0(long long N)
{
    return N;
}

long long f1(long long N, long long gA, long long gB)
{
    return N%gA + N/gA*gB;
}

long long f2(long long N, long long gA, long long sA, long long gB, long long sB)
{
    long long ans = N;
    for (long long ng=0; ng*gA<=N; ng++)
    {
        long long ns = (N-ng*gA)/sA;
        ans = max(ans, N-ng*gA-ns*sA+ng*gB+ns*sB);
    }
    return ans;
}

long long f3(long long N, long long gA, long long sA, long long bA, long long gB, long long sB, long long bB)
{
    long long ans = N;
    for (long long ng=0; ng*gA<=N; ng++)
    for (long long ns=0; ng*gA+ns*sA<=N; ns++)
    {
        long long nb = (N-ng*gA-ns*sA)/bA;
        ans = max(ans, N-ng*gA-ns*sA-nb*bA+ng*gB+ns*sB+nb*bB);
    }
    return ans;
}

int main()
{
    long long N;
    cin>>N;
    long long pA[3], pB[3];
    cin>>pA[0]>>pA[1]>>pA[2]>>pB[0]>>pB[1]>>pB[2];

    vector<long long> p1A, p1B, p2A, p2B;
    for (int i=0; i<3; i++)
        if (pA[i] < pB[i])
        {
            p1A.push_back(pA[i]);
            p1B.push_back(pB[i]);
        }
        else
        {
            p2A.push_back(pA[i]);
            p2B.push_back(pB[i]);
        }

    switch (p1A.size())
    {
    case 0: N = f0(N); break;
    case 1: N = f1(N, p1A[0], p1B[0]); break;
    case 2: N = f2(N, p1A[0], p1A[1], p1B[0], p1B[1]); break;
    case 3: N = f3(N, p1A[0], p1A[1], p1A[2], p1B[0], p1B[1], p1B[2]); break;
    }
    switch (p2A.size())
    {
    case 0: N = f0(N); break;
    case 1: N = f1(N, p2B[0], p2A[0]); break;
    case 2: N = f2(N, p2B[0], p2B[1], p2A[0], p2A[1]); break;
    case 3: N = f3(N, p2B[0], p2B[1], p2B[2], p2A[0], p2A[1], p2A[2]); break;
    }
    cout<<N<<endl;
}


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

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

    ll ans = 0;

    for (int i = 1; i < n+1; ++i) {
        if ((i%3 != 0) && (i%5 != 0)) {
            if (i%3 != 0) {
                if (i%5 != 0) {
                    ans += i;
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3644
using namespace std;
#define _CRT_SECURE_NO_WARNINGS
#pragma target("avx")
#pragma optimize("O3")
#pragma optimize("unroll-loops")
#include<iostream>
#include<algorithm>
#include<ctime>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<iomanip>
#include<numeric>
#include<queue>
#include<deque>
#include<cfloat>
#include<functional>
#include<tuple>
#include<math.h>
#include<bitset>
#include<stack>
#include<set>
#include<random>
#include<stdlib.h>
#define rip(i,n) for(ll i=0;i<n;i++)
#define Rip(i,n) for(ll i=1;i<n;i++)
#define all(V) V.begin(),V.end()
#define ll long long
#define ld long double
#define MOD 998244353
#define mod MOD
#define sec setprecision
constexpr double eps = 1e-9;
constexpr double PI = 3.141592653589793238462643383279;
ll gcd(ll a, ll b) {
	if (a % b == 0)	return(b);
	else return(gcd(b, a % b));
}
ll lcm(ll a, ll b)
{
	return a * b / gcd(a, b);
}
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
void cominit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (ll i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}
vector<ll> soinnsuubunnkai(ll n) {
	vector<ll>a;
	while (n % 2 == 0) {
		a.push_back(2);
		n /= 2;
	}
	ll f = 3;
	while (f * f <= n) {
		if (n % f == 0) {
			a.push_back(f);
			n /= f;
		}
		else f += 2;
	}
	if (n != 1)
		a.push_back(n);
	return(a);
}
// 二項係数計算
long long com(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
ll pow(ll a, ll b) {
	a = a % mod;
	if (b == 0)return(1);
	else if (b % 2 == 0)return(pow((a * a) % mod, b / 2));
	else return(a * (pow(a, b - 1)));
}
void solve() {
	int n, m;
	cin >> n >> m;
	if (n <= 9 && m <= 9)cout << n * m << endl;
	else cout << -1 << endl;
}
int main() {
	solve();
}

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

using namespace std;

set< string > st;

int main(){
	int n;

	cin >> n;

	string s;

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

		st.insert(s);
	}

	cout << st.size() << endl;

	return 0;
}

Measured memory_bytes: 19204
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define x first
#define y second

using namespace std;

typedef long long ll;

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n, k;
    cin >> n >> k;
    if (k % 2 == 1)
    {
        int t = n / k;
        cout << (ll) t * (ll) t * (ll) t;
    }
    else
    {
        int t = n / k, p;
        if (n < k / 2) p = 0;
        else p = (n - k / 2) / k + 1;
        cout << (ll) t * (ll) t * (ll) t + (ll) p * (ll) p * (ll) p;
    }
    return 0;
}


Measured memory_bytes: 384
N = int(input())

s = 0
y = 0

for c in range(26):
    for d in range(15):
        s = c*4 + d*7
        if s == N:
            y += 1
            print('Yes')
            break
        else:
            pass
    if y > 0:
        break
    else:
        pass

if y == 0:
    print('No')
else:
    pass

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
char f[15][15];
int dx[4]={-1,1,0,0},dy[4]={0,0,-1,1};

void dfs(int x,int y){
    f[x][y]='0';
    for(int i=0;i<4;i++){
        if(f[x+dx[i]][y+dy[i]]=='1')dfs(x+dx[i],y+dy[i]);
    }
    return;
}

int main(void){
    char c;int ans=0;
    while(cin>>c){
        ans=0;
        for(int i=1;i<13;i++){
            for(int j=1;j<13;j++){
                if(i+j==2)f[i][j]=c;
                else cin>>f[i][j];
            }
        }
        for(int i=1;i<13;i++){
            for(int j=1;j<13;j++){
                if(f[i][j]=='1'){
                    ans++;dfs(i,j);
                }
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}



Measured memory_bytes: 2976
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <math.h>
#include <chrono>
using namespace __gnu_pbds;
using namespace __gnu_pbds;
using namespace std;
//#pragma GCC optimize (-O3)
//#define endl tutaj

#define mp make_pair
#define st first
#define nd second
#define pii pair<int, int>
#define pb push_back
#define _upgrade ios_base::sync_with_stdio(0), cout.setf(ios::fixed), cout.precision(10) //cin.tie(0); cout.tie(0);
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define FWD(i, a, b) for (int i = (a); i < (b); ++i)
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set; // find_by_order(x) <-returns x-th element   order_of_key(x) <- returns order of element x
#define int long long

int h, w, n;
const int MOD = (int)(1e9) + 7;
const int MAXSUM = 3e5;
int factorial[MAXSUM];
int przydatny[MAXSUM];
int val[100000];
vector<pair<pii, int>> V;

int fas_pow(int podstawa, int wykladnik)
{
    if (wykladnik == 1)
        return podstawa;
    if (wykladnik & 1)
        return (fas_pow(podstawa, wykladnik - 1) * podstawa) % MOD;
    int x = fas_pow(podstawa, wykladnik / 2);
    return (x * x) % MOD;
}
inline int odwrotnosc(int x)
{
    return fas_pow(x, MOD - 2);
}

inline int get_wartosc(pii X, pii odnosnik)
{
    X.st -= odnosnik.st;
    X.nd -= odnosnik.nd;
    //  cerr << factorial[X.st + X.nd] << " " << odwrotnosc(factorial[X.st]) << " " << odwrotnosc(factorial[X.nd]) << endl;
    return (((factorial[X.st + X.nd] * przydatny[X.st]) % MOD) * przydatny[X.nd]) % MOD;
}
inline bool mniejszy(pii X, pii Y)
{
    return (X.st <= Y.st && X.nd <= Y.nd);
}

void policz(int k)
{
    cerr << V[k].nd << ": " << V[k].st.st << " " << V[k].st.nd << endl;
    val[V[k].nd] = get_wartosc(V[k].st, mp(1, 1));
    cerr << "wartosc: " << get_wartosc(V[k].st, mp(1, 1)) << endl;
    REP(i, k)
    if (mniejszy(V[i].st, V[k].st))
        val[V[k].nd] = (val[V[k].nd] - (val[V[i].nd] * get_wartosc(V[k].st, V[i].st)) + MOD * MOD) % MOD;
}

void wczytywanie()
{
    cin >> h >> w >> n;
    factorial[0] = 1;
    przydatny[0] = 1;
    // V.push_back(0, 0, n + 1);
    for (int i = 1; i < MAXSUM; i++)
    {
        factorial[i] = (factorial[i - 1] * i) % MOD;
        przydatny[i] = odwrotnosc(factorial[i]);
    }
    REP(i, n)
    {
        int x, y;
        cin >> x >> y;
        V.push_back(mp(mp(x, y), i));
    }
    V.push_back(mp(mp(h, w), n));
    sort(V.begin(), V.end());
    REP(i, n + 1)
    policz(i);
    REP(i, n + 1)
    cerr << val[i] << endl;
    cout << val[n] << endl;
}

main()
{
    _upgrade;
    wczytywanie();
}


Measured memory_bytes: 5120
H, W = map(int, input().split())
pattern = [H//2 + W//3 + 1, W//3 + H//2 + 1, H, W]
if H % 3 == 0 or W % 3 == 0:
    pattern += [0]
if H % 2 == 0:
    pattern += [H//2]
if W % 2 == 0:
    pattern += [W//2]
print(min(pattern))


Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int A = sc.nextInt();
        int B = sc.nextInt();
        int ans = Math.min(A*N, B);
        System.out.println(ans);
    }
}

Measured memory_bytes: 24020
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cassert>
#include <functional>
#include <string>
using namespace std;


int main(){
  int n, m;
  cin >> n >> m;
  cout << (n-1) * (m -1) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>
#include <queue>
#include <cstdio>
#include <cmath>

using namespace std;

#define loop(i,a,b) for(int i=(a); i<int(b); i++)
#define rep(i,b) loop(i,0,b)

int main(){
    int n; cin >> n;
    rep(i,n){
        int h,m;
        scanf("%d:%d",&h,&m);
        h=h*60+m;
        m*=720/60;
        int dt=min(abs(h-m),60*12-abs(h-m));
        // cout << dt << endl;
        string ans;
        if(dt<60*1) ans = "alert";
        else if(dt>=60*3) ans = "safe";
        else ans = "warning";
        cout << ans << endl;
    }
}

Measured memory_bytes: 1232
#include <iostream>
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <set>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <bitset>
#include <stack>
#include <queue>
#include <ctype.h>

typedef long long int lli;
#define rep(i,s,N) for(int i=s;i<N;i++)
#define MOD 1000000007
#define more(a,b) (((a)>(b))?(a):(b))
#define less(a,b) (((a)<(b))?(a):(b))

using namespace std;

int main(void)
{
	int N; cin >> N;
	cout << (N + 1) / 2 << endl;


	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define endl '\n'
#define int long long
#define eps 1e-9
#define oo 1e7+5
#define f first
#define s second

using namespace std;

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

bool first_row_or_col(pair<int,int> p )
{
	return ((!p.f)||(!p.s));
}

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

	string s;
	string t;
	
	cin>>s>>t;
	int n=s.length();
	int m=t.length();
	string bla="";
	
	vector<vector<int>> dp(n+1,vector<int> (m+1,0));
	
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < m; j++)
		{
			if(s[i]==t[j])
			{
				dp[i+1][j+1]=dp[i][j]+1;
			}
			else
			{
				
				dp[i+1][j+1]=max(dp[i+1][j],dp[i][j+1]);
			}
		}
		
	}
	
	int pos=dp[n][m];
	char ans[pos+1];
	ans[pos]='\0';
	
	while(n>0 && m>0)
	{
		if(s[n-1] == t[m-1])
		{
			ans[pos-1]= s[n-1];
			pos--;n--;m--;
		}
		else if(dp[n-1][m]>dp[n][m-1])
		{
			n--;
		}
		else m--;
	}
	
	cout<<ans<<endl;
	
	return 0;
}


Measured memory_bytes: 70784
n, m = map(int, input().split())
ac = [False]*n
wa = [0]*n

for i in range(m):
    p, s = input().split()
    p = int(p) - 1

    if s == "AC":
        ac[p] = True
    
    if s == "WA" and ac[p] == False:
        wa[p] += 1

ac_ans = ac.count(True)
wa_ans = sum([wa[i] for i in range(n) if ac[i] == True])

print(ac_ans, wa_ans)

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

int main(void) {
  int n;
  cin >> n;
  f1(i, 1, 9) f1(j, 1, 9) {
    if (i * j == n) {
      cout << "Yes" << '\n';
      return 0;
    }
  }
  cout << "No" << '\n';
  return 0;
}

Measured memory_bytes: 3640
#include<iostream>
#include<string>
using namespace std;
int main()
{
	string t;
	int k,s=0,i;
	cin>>t;
	for(i=0;i<t.length();i++)
	{
		s=s+t[i]-48;
	}

	if(s==0)
	{
		cout<<"Yes"<<endl;
	}
	else if(s%9==0)
	{ 
	
	cout<<"Yes"<<endl;}
	else 
	{
	cout<<"No"<<endl;}
	
	return 0;
}

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

#define REP(i, x) REPI(i, 0, x)
#define REPI(i, a, b) for (int i = int(a); i < int(b); ++i)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  int N;
  cin >> N;
  map<string, int> count;
  string s;
  int max_count = 0;
  REP(i, N) {
    cin >> s;
    if (count.find(s) != count.end()) {
      ++count.at(s);
      max_count = max(max_count, count.at(s));
    } else {
      count.insert(make_pair(s, 0));
    }
  }

  for (auto it : count) {
    if (it.second == max_count) {
      cout << it.first << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 23808
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main(){
    int h, w;
    cin >> h >> w;
    vector<vector<char>> hw(h, vector<char>(w));
    queue<pair<int, int>> que;
    rep(i, h) rep(j, w) {
        cin >> hw[i][j];
        if ( hw[i][j] == '#' ) {
            que.push(make_pair(i, j));
        }
    }
    int dy[4] = {1, -1, 0, 0};
    int dx[4] = {0, 0, 1, -1};
    bool ans = true;
    while(!que.empty()) {
        pair<int, int> now = que.front(); que.pop();
        bool ok = false;
        rep(i, 4) {
            int check_y = now.first + dy[i];
            int check_x = now.second + dx[i];
            if ( check_y >= h || check_x >= w || check_y < 0 || check_x < 0 ) {
                continue;
            }
            if ( hw[check_y][check_x] == '#' ) {
                ok = true;
            }
        }
        if ( !ok ) {
            ans = false;
        }
    }
    cout << ( ans ? "Yes" : "No" ) << endl;
    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
def main():
  a, b, c=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
  if a+b+c >= 22:
    print("bust")
  else:
    print("win")

if __name__ == '__main__':
    main()

Measured memory_bytes: 2940
object Main extends App{
    	//val s = readLine
	//val i = readLine.toInt
	//val ss = readLine.split(" ")
	val ii = readLine.split(" ").map(_.toInt) 
	val (x,y) = (ii(0),ii(1))
    println(s"${x * y} ${x * 2 + y * 2}")

}

Measured memory_bytes: 43816
#include <cstdio>
#include <algorithm>
const long long MOD = 1000000007;
int N, K, d[10000], w[10000], L;
long long O;
long long POWER(long long a, long long b)
{
	long long r = 1;
	for (; b; b >>= 1)
	{
		if (b & 1)
			r = r * a % MOD;
		a = a * a % MOD;
	}
	return r;
}
int main()
{
	scanf("%d%d", &N, &K);
	for (int i = 1; i * i <= N; i++)
		if (N % i == 0)
		{
			d[L++] = i;
			if (i * i < N)
				d[L++] = N / i;
		}
	std::sort(d, d + L);
	for (int i = 0; i < L; i++)
		w[i] = d[i];
	for (int i = L - 1; i >= 0; i--)
		for (int j = i + 1; j < L; j++)
			if (d[j] % d[i] == 0)
				w[i] -= w[j];
	for (int i = 0; i < L; i++)
		O = (O + (w[i] + MOD) * POWER(K, N / d[i] & 1 ? d[i] + 1 >> 1 : d[i])) % MOD;
	printf("%lld\n", O);
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i=0; i<(int)n; i++)
int main(){
  cout<<fixed<<setprecision(10);
  int N;cin>>N;
  vector<double> A(N);
  double by = 1;
  rep(i,N){
    cin>>A[i];
    by *= A[i];
  }
  double sum = 0;
  rep(i,N){
    sum += by/A[i];
  }
  cout<<by/sum<<endl;
}

Measured memory_bytes: 256
N = int(input())
if N % 2 == 1:
  print(0)
  exit()
two = 2
two_cnt = 0
while two <= N:
  two_cnt += (N // two)
  two *= 2
five = 5
five_cnt = 0
while five <= N:
  five_cnt += (N // five) // 2
  five *= 5
#print(two_cnt,five_cnt)
print(min(two_cnt,five_cnt))

Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

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

    int ans = 0;

    for (int i = 1; i <= n; i++) {
        int tmp = i, sum = 0;
        while (tmp) {
            sum += tmp % 10;
            tmp /= 10;
        }
        if (sum >= a and sum <= b) {
            ans += i;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<int,int>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
const ll mod=1000000007;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
V<ll> a;
ll n,k;
bool C(ll m){
   ll cnt=0,l,r,mid;
   for(int i=0;i<n;i++){
      if(a[i]>=0){
         l=i,r=n;
         while(r-l>1){
            mid=(l+r)/2;
            if(a[i]*a[mid]>m)r=mid;
            else l=mid;
         }
         cnt+=l-i;//iを含まないため
      }
      else{
         l=n,r=i;
         while(l-r>1){
            //負の場合、値は単調減少
            mid=(l+r)/2;
            if(a[i]*a[mid]>m)r=mid;
            else l=mid;
         }
         cnt+=n-l;
      }
   }
   return cnt>=k;
}
int main(){
cin>>n>>k;
a.resize(n);
for(int i=0;i<n;i++)cin>>a[i];
sort(all(a));
ll l=-inf-5,r=inf+5,mid;
while(r-l>1){
   mid=(l+r)/2;
   if(C(mid))r=mid;
   else l=mid;
}
cout<<r<<endl;
}

Measured memory_bytes: 1792
#include <stdio.h>

int main(int argc, const char * argv[]) {
    // insert code here...
    int i=1;
    while(1){
        int x;
        scanf("%d",&x);
        
        if(x==0){
            break;
        }
        
        printf("Case %d: %d\n",i,x);
        
        i++;
    }
    
    
    return 0;
}

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

int main(){
  ll h;
  cin >> h;
  ll m = h;
  //cout << h << endl;
  ll counts =0;
  if(h == 1) cout << 1 << endl;
  else{
   while(h!=1){
          h = h/2;
     counts++;

   }
  ll sum =0;
  rep(i,counts+1){
    sum += pow(2,i);
  }
  cout << sum << endl;
  }
}


Measured memory_bytes: 4124
#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 FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 1e18;
const long double EPS = 1e-10;

int main() {
  int n, T;
  cin >> n >> T;
  vector<int> t(n);
  rep(i, n) cin >> t[i];

  ll ans = T;
  rep(i, n - 1) ans += min(T, t[i + 1] - t[i]);
  cout << ans << endl;
  


  
  return 0;
}

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

typedef long long ll;

const int mod = 1000000007;
const int Maxn = 1005;

int n, m;
int R[Maxn], C[Maxn];
int res = 1;

bool Less(const int &a, const int &b)
{
    return a > b;
}

int main()
{
    scanf("%d %d", &n, &m);
    for (int i = 0; i < n; i++)
        scanf("%d", &R[i]);
    for (int j = 0; j < m; j++)
        scanf("%d", &C[j]);
    sort(R, R + n, Less);
    sort(C, C + m, Less);
    int a = 0, b = 0;
    for (int i = 0; i + 1 < n; i++)
        if (R[i] == R[i + 1]) { printf("0\n"); return 0; }
    for (int i = 0; i + 1 < m; i++)
        if (C[i] == C[i + 1]) { printf("0\n"); return 0; }
    for (int i = n * m; i > 0; i--) {
        int was = n * m - i;
        bool myrow = a < n && R[a] == i;
        bool mycol = b < m && C[b] == i;
        if (myrow && mycol) { a++; b++; }
        else if (myrow) { res = ll(res) * b % mod; a++; }
        else if (mycol) { res = ll(res) * a % mod; b++; }
        else res = ll(res) * (a * b - was) % mod;
    }
    printf("%d\n", res);
    return 0;
}


Measured memory_bytes: 384
import java.util.*;

public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int k = sc.nextInt();
    int x = sc.nextInt();
    int y = sc.nextInt();
    int result = 0;
    if(n > k){
      result = k*x + (n-k)*y;
    }else{
      result = n*x;
    }
    
    System.out.println(result);
  }
}

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

using namespace std;

int main()
{
  double l;
  cin>>l;
  
  double v=(l/3)*(l/3)*(l/3);
  
  printf("%12f\n",v);
  //cout<<v<<endl;
  //cout<<(l/3)*(l/3)*(l/3)<<endl;
}

Measured memory_bytes: 256
//package com.company;
import java.util.*;
import java.lang.*;
import java.io.*;
//****Use Integer Wrapper Class for Arrays.sort()****
class Main {
    static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));
    public static void main(String[] Args){
        FastReader scan=new FastReader();
        int t=1;
//        t=scan.nextInt();
        while(t-->0){
            String s=scan.next();
            if(s.compareTo("ABC")==0){
                out.println("ARC");
            }else{
                out.println("ABC");
            }
        }
        out.flush();
        out.close();
    }
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

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

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

}


Measured memory_bytes: 32712
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repe(i,n) for (int i = 0; i <= (n); ++i)
#define repe1(i,n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define eb(k,v) emplace_back(k,v)
#define ct(res) cout << res << "\n";
#define vi vector<int>
#define vl vector<ll>
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9;
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;


void recursive_comb(int *indexes, int s, int rest, std::function<void(int *)> f) {
  if (rest == 0) {
    f(indexes);
  } else {
    if (s < 0) return;
    recursive_comb(indexes, s - 1, rest, f);
    indexes[rest - 1] = s;
    recursive_comb(indexes, s - 1, rest - 1, f);
  }
}

// nCkの組み合わせに対して処理を実行する
void foreach_comb(int n, int k, std::function<void(int *)> f) {
  int indexes[k];
  recursive_comb(indexes, n - 1, k, f);
}

ll modPow(ll x, ll n) {
    if(n==0) return 1;
    ll res = modPow(x*x%MOD, n/2);
    if(n&1) res=res*x%MOD;
    return res;
}
ll mul(ll l, ll r) {
    ll ret =1;
    for(int i=0; i<l-r+1; ++i) {
        ret*=i+r;
        ret%=MOD;
    }
    return ret;
}
ll com(ll n, ll k) {
    ll ret1 = mul(n,n-k+1);
    ll ret2 = mul(k,1);
    ll ret3 = modPow(ret2, MOD-2);
    return ret1*ret3%MOD;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n; cin >>n;
    string s; cin >> s;
    int ans = 0;
    rep(i,n) {
      if (s.substr(i,3) =="ABC") {
        ans++;
      }
    }
    ct(ans);
}



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

using ui = unsigned int;
using ll = long long;
using ull = unsigned long long;
using str = string;
using bl = bool;
using ch = char;

template<class T> using v = vector<T>;
template<class T> using uset = unordered_set<T>;
template<class T1, class T2> using umap = unordered_map<T1, T2>;

template<class T> void pd(T x)
{
    cout << x << " ";
}
template<class T> void pl(T x)
{
    cout << x << endl;
}

#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define sz(x) ((int)(x).size())
#define ph push_back
#define pp pop_back
#define mp make_pair
#define rep(i, a) for(int i = 0; i < (int)a; ++i)
#define repd(i, a) for(int i = (int)a; i >= 0; --i)
#define REP(i, a, b) for(int i = a; i < (int)b; ++i)
#define REPD(i, a, b) for(int i = (int)a; i >= b; --i)
#define fore(i, a) for(auto& i : a)
#define FORE(i, a) for(auto i : a)

// -----



int main()
{
    const double pi = 3.141592653589793;
    double a, b, h, m;
    cin >> a >> b >> h >> m;
    
    double hm = abs(((h * 60 + m) / 2) - (m * 6));
    hm = min(hm, 360.0f - hm);
    cout << fixed << setprecision(20) << sqrt(a*a + b*b - (2*a*b*cos(pi/(180/hm)))) << endl;
}

Measured memory_bytes: 4104
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f3f3f3f3f
#define RG register
#define maxn 200005
#define maxm 200005
using namespace std;
typedef long long ll;
inline ll read(){
    ll x = 0, f = 1;
    char ch = getchar();
    while(ch > '9' || ch < '0') {if(ch == '-') f = -1;ch = getchar();}
    while(ch >= '0' && ch <= '9'){x = x *10 + ch -'0';ch = getchar();}
    return x * f;
}
int r,c,k;
ll dp[3005][3005][4],mp[3005][3005];
int main(){
	int i,j,u,v,w;
	ll mx;
	r=read(),c=read(),k=read();
	for(i=1;i<=k;i++) u=read(),v=read(),w=read(),mp[u][v]=w;
	for(i=1;i<=r;i++){
		for(j=1;j<=c;j++){
			mx=0;
			for(u=0;u<=3;u++) mx=max(mx,dp[i-1][j][u]);
			for(u=0;u<=3;u++) dp[i][j][u]=max(dp[i][j][u],max(dp[i][j-1][u],mx));
			if(mp[i][j]){
				for(u=1;u<=3;u++) dp[i][j][u]=max(dp[i][j][u],dp[i][j-1][u-1]+mp[i][j]); 
				dp[i][j][1]=max(dp[i][j][1],mx+mp[i][j]);
			}
		}
	}
	mx=0;
	for(u=0;u<=3;u++) mx=max(mx,dp[r][c][u]);
	printf("%lld\n",mx);
	return 0;
}

Measured memory_bytes: 355428
def ocean(_S):
    global S, count
    count += 1
    while _S:
        a = _S[0]
        n_S = []
        c = 1
        for v in _S[1:]:
            if v == a:
                c += 1
            else:
                n_S.append(v)
        else:
            dic[a] = str(c)
            _S = n_S
    else:
        _S = []
        for v in S:
            _S.append(dic[v])
        else:
            if S == _S:
                print count-1
                print ' '.join(_S)
                return
            else:
                S = _S[:]
                ocean(_S)

while True:
    N = int(raw_input())
    if N == 0: break
    S = raw_input().split(' ')
    dic = {}
    count = 0
    ocean(S[:])

Measured memory_bytes: 4236
import sys
from collections import Counter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

h,w,a,b=mp()
for i in range(b):
    print("1"*a+"0"*(w-a))
for i in range(h-b):
    print("0"*a+"1"*(w-a))

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

using namespace std;

#define N 1200
#define M 300000

int n,m,x[M],y[M],vis[2][N][N];
vector<int> vec[N];

void dfs(int op,int o,int u,int k){
	if (vis[op][o][u]) return;
	vis[op][o][u]=k;
	for (int i=0;i<(int)vec[u].size();++i)
		dfs(op,o,vec[u][i],k);
}

int main(){
	scanf("%d%d",&n,&m);
	for (int i=1;i<=m;++i){scanf("%d%d",&x[i],&y[i]); vec[x[i]].push_back(y[i]);}
	for (int i=1;i<=n;++i){
		vis[0][i][i]=vis[1][i][i]=1;
		for (int j=0;j<(int)vec[i].size();++j)
			dfs(0,i,vec[i][j],j+1);
		if (vec[i].size())
			for (int j=(int)vec[i].size()-1;j>=0;--j)
				dfs(1,i,vec[i][j],j+1);
	}
	for (int i=1;i<=m;++i){
		int u=x[i],v=y[i];
		puts((vis[0][u][v]!=vis[1][u][v])^(vis[0][v][u]>0)?"diff":"same");
	}
	
	return 0;
}
			

Measured memory_bytes: 15872
### constant

DXYS = [[0, 1], [1, 0], [0, -1], [-1, 0]]

### main

loop do
  m, n = gets.split.map(&:to_i)
  break if (m | n) == 0

  x = y = 1
  d = 0
  #p [x, y, d]

  loop do
    cmds = gets.strip.split
    #p cmds

    case cmds[0]
    when 'FORWARD'
      k = cmds[1].to_i
      dx, dy = DXYS[d]
      k.times do
        x0 = x + dx
        y0 = y + dy
        break if x0 < 1 || x0 > m || y0 < 1 || y0 > n
        x = x0
        y = y0
      end
    when 'BACKWARD'
      k = cmds[1].to_i
      dx, dy = DXYS[d]
      k.times do
        x0 = x - dx
        y0 = y - dy
        break if x0 < 1 || x0 > m || y0 < 1 || y0 > n
        x = x0
        y = y0
      end
    when 'LEFT'
      d = (d + 3) % 4
    when 'RIGHT'
      d = (d + 1) % 4
    when 'STOP'
      break
    end
    #p [x, y, d]
  end

  puts [x, y].join(' ')
end

Measured memory_bytes: 6120
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));



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

	int H,W,a,b;
	cin >> H >> W >> a >> b;

	cout << (H - a) * (W - b) << endl;

	return 0;
}



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

int digit(long long x)
{
    int res=0;
    while(x!=0)
    {
        x/=10;
        res++;
    }
    return res;
}
int main(void)
{
    cin>>N;
    int cnt=INT_MAX;
    int len1;
    int len2;
    for(long long i=1; i*i<=N; i++)
    {
        if(N%i==0)
        {
            len1=digit(i);
            len2=digit(N/i);
            cnt=min(cnt,max(len1,len2));
        }
    }
    cout << cnt <<endl;
    return 0;
}


Measured memory_bytes: 256
-- https://github.com/minoki/my-atcoder-solutions
import Data.Char (isSpace)
import Data.List (unfoldr)
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as U
import qualified Data.ByteString.Char8 as BS
import Data.Bits

main = do
  [n,m] <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  keys <- V.replicateM m $ do
    [a,b] <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
    c <- U.unfoldrN b (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
    return (a,c)
  let v0 :: U.Vector Int
      v0 = U.generate (2^n) (\x -> if x == 0 then 0 else 10^9)
      result = V.foldl' (\v (a,c) -> U.generate (2^n) $ \x ->
                            if x == 0
                            then 0
                            else min (v U.! x) $ let cc = U.foldl' (\y i -> y .|. bit (i-1)) 0 c
                                                 in (v U.! (x .&. complement cc)) + a
                        ) v0 keys
  print $ if result U.! (2^n - 1) >= 10^9 then -1 else result U.! (2^n - 1)


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

int main() {
  int n; string s;
  cin >> n >> s;
  int t = s.size();
  if(n == 1) {
    cout << "No" << endl;
    return 0;
  }
  if(s.substr(0, t/2) == s.substr(t/2, t)) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
using ll = long long ;
using P = pair<ll, ll>;
using Vec = vector<ll>;
#define FOR(i, m, n) for(ll (i) = (m); (i) < (n); (i)++)
#define FORN(i, m, n) for(ll (i) = (m); (i) <= (n); (i)++)
#define FORR(i, m, n) for(ll (i) = (m); (i) >= (n); (i)--)
#define rep(i, n) FOR(i, 0, n)
#define repn(i, n) FORN(i, 1, n)
#define repr(i, n) FORR(i, n, 0)
#define repnr(i, n) FORR(i, n, 1)
#define co(n) cout << (n) << endl
#define cosp(n) cout << (n) << ' '
#define setp(n) cout << fixed << setprecision(n);
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second

const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const double PI = acos(-1);
const double EPS = 1e-9;

int main(void){
	string s, t;
	cin >> s >> t;
	ll s_len = s.length(), t_len = t.length();
	if(s_len < t_len){
		puts("UNRESTORABLE");
		return 0;
	}
	bool flg = true;
	repr(i, s_len-t_len){
		flg = true;
		rep(j, t_len){
			if(s[i+j] != t[j] && s[i+j] != '?'){
				flg = false;
				break;
			}
		}
		if(flg){
			rep(j, s_len){
				if(j >= i && j < i+t_len) cout << t[j-i];
				else if(s[j] == '?') cout << 'a';
				else cout << s[j];
			}
			cout << endl;
			return 0;
		}
	}

	puts("UNRESTORABLE");
	return 0;
}


Measured memory_bytes: 256
from collections import deque

K = int(input())
queue = deque(["1", "2", "3", "4", "5", "6", "7", "8", "9"])
lunlun = ["1", "2", "3", "4", "5", "6", "7", "8", "9"]

while len(queue) < 10 ** 5:
    n_str = queue.popleft()
    last_c = n_str[len(n_str) - 1]
    if last_c == "0":
        queue.append(n_str + "0")
        queue.append(n_str + "1")

        lunlun.append(n_str + "0")
        lunlun.append(n_str + "1")
    elif last_c == "1":
        queue.append(n_str + "0")
        queue.append(n_str + "1")
        queue.append(n_str + "2")

        lunlun.append(n_str + "0")
        lunlun.append(n_str + "1")
        lunlun.append(n_str + "2")
    elif last_c == "2":
        queue.append(n_str + "1")
        queue.append(n_str + "2")
        queue.append(n_str + "3")

        lunlun.append(n_str + "1")
        lunlun.append(n_str + "2")
        lunlun.append(n_str + "3")
    elif last_c == "3":
        queue.append(n_str + "2")
        queue.append(n_str + "3")
        queue.append(n_str + "4")

        lunlun.append(n_str + "2")
        lunlun.append(n_str + "3")
        lunlun.append(n_str + "4")
    elif last_c == "4":
        queue.append(n_str + "3")
        queue.append(n_str + "4")
        queue.append(n_str + "5")

        lunlun.append(n_str + "3")
        lunlun.append(n_str + "4")
        lunlun.append(n_str + "5")
    elif last_c == "5":
        queue.append(n_str + "4")
        queue.append(n_str + "5")
        queue.append(n_str + "6")

        lunlun.append(n_str + "4")
        lunlun.append(n_str + "5")
        lunlun.append(n_str + "6")
    elif last_c == "6":
        queue.append(n_str + "5")
        queue.append(n_str + "6")
        queue.append(n_str + "7")

        lunlun.append(n_str + "5")
        lunlun.append(n_str + "6")
        lunlun.append(n_str + "7")
    elif last_c == "7":
        queue.append(n_str + "6")
        queue.append(n_str + "7")
        queue.append(n_str + "8")

        lunlun.append(n_str + "6")
        lunlun.append(n_str + "7")
        lunlun.append(n_str + "8")
    elif last_c == "8":
        queue.append(n_str + "7")
        queue.append(n_str + "8")
        queue.append(n_str + "9")

        lunlun.append(n_str + "7")
        lunlun.append(n_str + "8")
        lunlun.append(n_str + "9")
    elif last_c == "9":
        queue.append(n_str + "8")
        queue.append(n_str + "9")

        lunlun.append(n_str + "8")
        lunlun.append(n_str + "9")

print(lunlun[K-1])


Measured memory_bytes: 92808
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

#define MOD 1000000007
#define PI 3.14159265358979

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;

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

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};

typedef vector< edge > edges;
typedef vector< edges > graph;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;

template < typename T >
bool chmin(T &x, const T &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T >
bool chmax(T &x, const T &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(11);
	}
};
initializer _____;

ll N, M, K, T, Q;
vector< ll > A;
vector< ll > F;
bool check(ll m) {
	ll k = 0;
	rep(i, N) {
		ll a = A[i];
		ll f = F[i];
		k += max(0LL, a - (m / f));
		if (k > K)
			return false;
	}
	return true;
}
int main() {

	cin >> N >> K;
	A = vector< ll >(N);
	F = vector< ll >(N);
	rep(i, N) cin >> A[i];
	rep(i, N) cin >> F[i];
	sort(A.begin(), A.end());
	sort(F.begin(), F.end());
	reverse(F.begin(), F.end());
	ll l = -1, r = LLONG_MAX / 4;
	while (r - l > 1) {
		ll m = (l + r) / 2;
		if (check(m)) {
			r = m;
		} else {
			l = m;
		}
	}
	cout << r << endl;
	return 0;
}

Measured memory_bytes: 3328
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		String[] ss = br.readLine().split(" ");

		int[] S  = new int[n];

		for(int i=0; i<n; i++){
			S[i] = Integer.parseInt(ss[i]);
		}

		int q = Integer.parseInt(br.readLine());

		String[] qq = br.readLine().split(" ");

		int[] Q = new int[q];


		for(int i=0; i<q; i++){
			Q[i] = Integer.parseInt(qq[i]);
		}

		int count =0;

		for(int i=0; i<q; i++){
			for(int k=0; k<n; k++){
				if(S[k] == Q[i]){
					count++;
					break;
				}
			}
		}

		System.out.println(count);



	}

}

Measured memory_bytes: 26980
#include <iostream>
#include <string>
#include <math.h>
#include<algorithm>
using namespace std;
 
int main(){
  int N,K,X,Y;
  cin >> N;
  cin >> K;
  cin >> X;
  cin >> Y;
  if(N<=K){
   cout << N*X << endl; 
  }
  else{
  cout << K*X+(N-K)*Y << endl;
  }
  return 0;}

Measured memory_bytes: 256
// 未解決

#include <bits/stdc++.h>

#include <iostream>
using namespace std;

#define EACH(i, a) for (auto &&i : a)
#define FOR(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define RFOR(i, a, b) for (int i = (int)b - 1; i >= (int)a; --i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREPS(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(x) (x).begin(), (x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
#define debug(x) cout << #x << ": " << x << endl

#define pb push_back
#define mp make_pair
#define F first
#define S second

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define INF (1L << 30)
#define MOD (1000000007)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

template <class T>
void pv(T a, T b) {
  for (T i = a; i != b; ++i) cout << *i << " ";
  cout << endl;
}
template <class T>
void pvp(T a, T b) {
  for (T i = a; i != b; ++i)
    cout << "(" << i->first << ", " << i->second << ") ";
  cout << endl;
}
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int in() {
  int x;
  scanf("%d", &x);
  return x;
}

using ll = long long;
#define int ll

//**********

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

  int r;
  cin >> r;
  cout << r * 3.1415926535 * 2 << endl;

  return 0;
};


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

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

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

const int INF = 1001001001;
const int MOD = 1000000007;
const double PI=acos(-1);

int main(){
    int sx,sy,tx,ty;
    cin >> sx >> sy >> tx >> ty;

    int x1 = tx-sx;
    int y1 = ty-sy;
    rep(i,x1) {
        cout << 'R';
    }
    rep(i,y1) {
        cout << 'U';
    }
    cout << 'L';
    
    rep(i,y1-1) {
        cout << 'D';
    }
    rep(i,x1-1) {
        cout << 'L';
    }
    cout << 'D';

    cout << 'L';
    rep(i,y1+1) {
        cout << 'U';
    }
    rep(i,x1+1) {
        cout << 'R';
    }
    cout << 'D';
    cout << 'R';
    rep(i,y1+1) {
        cout << 'D';
    }
    rep(i,x1+1) {
        cout << 'L';
    }
    cout << 'U' << endl;
}


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

int main(){
  long long N,A,B;
  cin >> N >> A >> B;
  long long ans=0;
  if(A==B){
    ans=1;
  }else if(A<B&&N>1){
    ans = B*(N-2)-A*(N-2)+1;
  }
  cout << ans << endl;
  return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef unsigned int ui;

#define forn(i, n) for (int i = 1; i <= n; i++)
#define pb push_back
#define all(x) x.begin(), x.end()
#define y1 qewr1234

const double PI = acos(-1.0);
const int DIR = 4;
const int X[] = {1, 0, -1, 0};
const int Y[] = {0, 1, 0, -1};

using namespace std;

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

	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);

	int n, m;
	cin >> n >> m;
	vector < string > s(n);
	vector < vector < bool > > was(n, vector < bool > (m));
	for (int i = 0; i < n; i++)
	{	
		cin >> s[i];
	}
	int x = 0, y = 0;
	if (s[0][0] != '#')
	{
		cout << "Impossible" << endl;
		return 0;
	}
	while(true)
	{
		was[x][y] = true;
		if (x < n - 1 && s[x + 1][y] == '#')
		{
			x++;
		}
		else if (y < m - 1&& s[x][y + 1] == '#')
			y++;
		else 
			break;
	}
	if (x != n - 1 || y != m - 1)
	{
		cout << "Impossible" << endl;
		return 0;
	}
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < m; j++)
		{
			if (!was[i][j] && s[i][j] == '#')
			{
				 cout << "Impossible" << endl;
				 return 0;
			}
		}
	}
	cout << "Possible" << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  int KYR, MRKT = 0, YUNI = 0;
  
  a *= 60;
  a += b;
  c *= 60;
  c += d;
  
  KYR = c - a;
  
  cout << KYR - e << endl;
}

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

using namespace std;

double ans[301][301][301];
int licz[3];
int N,i,a,j,k;

double dp(int a, int b, int c){
	double A=a,B=b,C=c;
	double odp=0;
	if (a<0 || b<0 || c<0){
		return 0;
	}
	if (ans[a][b][c]!=-1){
		return ans[a][b][c];
	}
	odp=(A/N*dp(a-1,b,c))+(B/N*dp(a+1,b-1,c))+(C/N*dp(a,b+1,c-1))+1;
	odp*=N;
	odp/=a+b+c;
	ans[a][b][c]=odp;
	return ans[a][b][c];
}

int main(){
	cin >> N;
	for (i=0;i<N;i++){
		cin >> a;
		licz[--a]++;
	}
	for(i=0;i<=N;i++){
		for(j=0;j<=N;j++){
			for(k=0;k<=N;k++){
				ans[i][j][k]=-1;
			}
		}
	}
	ans[0][0][0]=0;
	cout << fixed << setprecision(10) << dp(licz[0],licz[1],licz[2]);
}


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

int main() {
	long long N, W;
	cin >> N >> W;
	priority_queue<long long> W1;
	priority_queue<long long> W2;
	priority_queue<long long> W3;
	priority_queue<long long> W4;
	long long memoW = 0;
	for (int i = 0;i<N;++i) {
		long long w, v;
		cin >> w >> v;
		if (0 == i) {
			memoW = w;
		}
		if (memoW == w) {
			W1.push(v);
		}
		else if (memoW +1 ==w) {
			W2.push(v);
		}
		else if (memoW+2 ==w) {
			W3.push(v);
		}
		else {
			W4.push(v);
		}
	}
	vector<long long>Sum1(W1.size()+1,0); 
	for (long long i = 0;i< Sum1.size()-1;++i) {
		int x = W1.top();
		W1.pop();
		Sum1[i + 1] = Sum1[i] + x;
	}
	vector<long long>Sum2(W2.size() + 1, 0);
	for (long long i = 0; i < Sum2.size() - 1; ++i) {
		int x = W2.top();
		W2.pop();
		Sum2[i + 1] = Sum2[i] + x;
	}
	vector<long long>Sum3(W3.size() + 1, 0);
	for (long long i = 0; i < Sum3.size() - 1; ++i) {
		int x = W3.top();
		W3.pop();
		Sum3[i + 1] = Sum3[i] + x;
	}
	vector<long long>Sum4(W4.size() + 1, 0);
	for (long long i = 0; i < Sum4.size() - 1; ++i) {
		int x = W4.top();
		W4.pop();
		Sum4[i + 1] = Sum4[i] + x;
	}
	long long ans = 0;
	for (long long i = 0; i < Sum1.size(); ++i) {
		for (long long j= 0; j < Sum2.size(); ++j) {
			for (long long k = 0; k < Sum3.size(); ++k) {
				for (long long l = 0; l < Sum4.size(); ++l) {
					long long x = memoW * i + (memoW + 1)*j + (memoW+2)*k + (memoW + 3)*l;
					if (x<=W) {
						long long y = Sum1[i] + Sum2[j] + Sum3[k] + Sum4[l];
						ans = max(ans, y);
					}
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3636
#include <cstdio>

int main()
{
    int a;
    int h;
    int m;
    int s;
    scanf("%d",&a);
    h = a/3600;
    m = (a-3600*h)/60;
    s = (a-3600*h-60*m);
    printf("%d:",h);
    printf("%d:",m);
    printf("%d\n",s);
    return 0;
}

Measured memory_bytes: 2724
N = int(input())
h = list(map(int,input().split()))
cnt = 0
if N == 1:
  pass
elif N==2:
  if h[0] <= h[1]:
    pass
  else:
    print('No')
    exit()
elif N >= 3:
  for i in range(N-2):
    if (h[i] - 1 == h[i+1]) and (cnt == 0):
      cnt += 1
    elif (h[i] < h[i+1]) and cnt == 1:
      cnt -= 1
    elif (h[i] - 1 == h[i+1]) and (cnt == 1):
      print('No')
      exit()
    if (h[i+1] > h[i+2]) and (h[i]-1 >= h[i+1]) :
      print('No')
      exit()
    elif (h[i] >= h[i+1]+2) or (h[i+1] >= h[i+2]+2):
      print('No')
      exit()
print('Yes')

Measured memory_bytes: 14480
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A;
  int B;
  cin>>A>>B;
  string S="No";
  for(int i=0;i<A+1;i++){
    if((4*A-2*i)==B){
      S="Yes";
      break;
      
    }
  }
  cout<<S<<endl;
    
}

Measured memory_bytes: 3628