akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstring>
#include<cstdio>
#define rep(i,s,t) for(int i=s;i<=t;i++)
#define dwn(i,s,t) for(int i=s;i>=t;i--)
#define MAXN 100010
using namespace std;
inline int read()
{
	int x=0,t=1,c;
	while(!isdigit(c=getchar()))if(c=='-')t=-1;
	while(isdigit(c))x=x*10+c-'0',c=getchar();
	return x*t;
}
int A[MAXN];
int op[MAXN];
long long normal[MAXN],rev[MAXN];
int main()
{
	int n=read();
	rep(i,1,n)
	{
		A[i]=read();
		if(i<n)
		{
			int c=getchar();
			while(c!='+'&&c!='-')c=getchar();
			if(c=='-')op[i+1]=-1;
			else op[i+1]=1;
		}
	}
	op[1]=1;
	normal[0]=0;
	rep(i,1,n)normal[i]=normal[i-1]+op[i]*A[i];
	long long sumv=0,ans=normal[n],block=0;
	dwn(i,n,1)
	{
		block+=A[i];
		if(op[i]==-1)
		{
			ans=max(ans,normal[i-1]-block+sumv);
			sumv+=block;
			block=0;
		}
	}
	printf("%lld",ans);
}

Measured memory_bytes: 1792
#include<cstdio>
#include<vector>
#include<iostream>
#include<cstring>
#include<queue>
using namespace std;
const int N = 2005;
int dis[N][N];
bool Map[N][N], Vis[N];
vector<int> G[N], Go[N];
queue<int> Q;
int BFS(int s, int k) {
    memset(Vis,0,sizeof(Vis));
    bool Can;
    int ans = 1, u, v;
    Vis[s] = true, Q.push(s);
    for(int j = 0; j < Go[s].size(); ++j) {
        Vis[Go[s][j]] = true;
    }    

    while(!Q.empty()) {
        u = Q.front(), Q.pop();
        for(int i = 0; i < G[u].size(); ++i) {
            v = G[u][i];
            if(!Vis[v]) {
                Vis[v] = true;
                for(int j = 0; j < Go[v].size(); ++j) {
                    Vis[Go[v][j]] = true;
                }
                Q.push(v);
                ++ans;
            }
        }
    }
    return ans;
}
struct P {
    int x, step;
};
queue<P> q;
void Dis(int s) {
    memset(Vis,0,sizeof(Vis));
    P u, v;
    u.x = s, u.step = 0, q.push(u);
    dis[s][s] = 0, Vis[s] = true;
    while(!q.empty()) {
        u = q.front(), q.pop();
        int x = u.x;
        for(int i = 0; i < G[x].size(); ++i) {
            v.x = G[x][i];
            if(!Vis[v.x]) {
                Vis[v.x] = true;
                v.step = u.step + 1;
                dis[s][v.x] = v.step;
                q.push(v);
            }
        }
    }
}

int main() {
    int n, k;
    cin >> n >> k;
    int x, y;
    for(int i = 1; i < n; ++i) {
        cin >> x >> y;
        G[x].push_back(y);
        G[y].push_back(x);
    }
    

    for(int i = 1; i <= n; ++i) Dis(i);

    for(int i = 1; i <= n; ++i)
        for(int j = 1; j <= n; ++j)
            if(dis[i][j] > k) {
                Go[i].push_back(j);
                Go[j].push_back(i);
            }

    int ans, Min = 0x7fffffff;
    for(int i = 1; i <= n; ++i) {
        ans = BFS(i,k);
        if(n-ans < Min) Min = n-ans;
    }
    
    cout << Min << '\n';
return 0;
}

Measured memory_bytes: 52960
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
string s,t;

int main(int argc, char const *argv[])
{
    cin>>s>>t;
    sort(s.begin(),s.end());
    sort(t.begin(),t.end());
    reverse(t.begin(),t.end());
    if(s<t){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s, n) for(int i = s; i < (int)(n); i++)
#define co(x) cout<<x<<endl
#define SQvec(i,j) vector<vector<int>> data(i, vector<int>(j))
#define mod 1000000007
typedef long long int lint;

int main(){
  int X;
  cin >> X;
  if(X < 30){co("No");}
  else{co("Yes");}
  
  return 0;
}

Measured memory_bytes: 3588
from collections import deque

def reachable(es, source):
	ret = {source}
	Q = deque([source])
	while Q:
		cur = Q.popleft()
		for nxt in es[cur]:
			if nxt not in ret:
				Q.append(nxt)
				ret.add(nxt)
	return ret

def SPFA(G:list, source=0):
	from collections import deque
	V = len(G)
	d = [float("inf")]*V
	inQ = [False]*V
	cnt = [0]*V
	d[source] = 0
	cnt[source] = 1
	Q = deque([source])
	_sum = 0
	_len = 1
	while Q:
		f = Q.popleft()
		inQ[f] = False
		_sum -= d[f]
		_len -= 1
		for t,c in G[f]:
			dist = d[f] + c
			if dist < d[t]:
				d[t] = dist
				if not inQ[t]:
					inQ[t] = True
					cnt[t] += 1
					if dist*_len < _sum:
						Q.appendleft(t)
					else:
						Q.append(t)
					_sum += dist
					_len += 1
				if cnt[t] > V:
					#negative cycle
					return None
	return d[-1]
	
def main():
	N,M,P,*L=map(int,open(0).read().split())
	fwd = [[] for _ in range(N)]
	bwd = [[] for _ in range(N)]
	G = [[] for _ in range(N)]
	for a,b in zip(L[::3],L[1::3]):
		fwd[a-1].append(b-1)
		bwd[b-1].append(a-1)
	judge = reachable(fwd,0) & reachable(bwd,N-1)
	for a,b,c in zip(*[iter(L)]*3):
		if a-1 in judge and b-1 in judge:
			G[a-1].append((b-1,P-c))
	ans = SPFA(G)
	if ans==None:
		print(-1)
	else:
		print(max(0,-ans))

if __name__=="__main__":
	main()

Measured memory_bytes: 51676
#include <cstdio>
#include <utility>
int a[1<<18];
int m[1<<18][2][2];
void upd(int x, int v, int o) {
    if(m[x][0][0] < v) {
        m[x][1][0] = m[x][0][0];
        m[x][1][1] = m[x][0][1];
        m[x][0][0] = v;
        m[x][0][1] = o;
    }
    else if(m[x][1][0] < v && m[x][0][1] != o) {
        m[x][1][0] = v;
        m[x][1][1] = o;
    }
}
int main() {
    int n;
    scanf("%d", &n);
    for(int i=0; i<(1<<n); i++) {
        scanf("%d", a+i);
        m[i][0][0] = a[i];
        m[i][0][1] = i;
        m[i][1][0] = -100000;
        m[i][1][1] = -1;
    }
    for(int i=0; i<(1<<n); i++) {
        for(int j=0; j<n; j++) {
            if(i&(1<<j)) continue;
            int t = i | (1<<j);
            upd(t, m[i][0][0], m[i][0][1]);
            upd(t, m[i][1][0], m[i][1][1]);
        }
    }
    for(int i=1; i<(1<<n); i++) {
        int x = i, ans = 0;
        ans = m[i][0][0] + m[i][1][0];
        while(x) {
            int t = -x&x; x^=t;
            int u = (i^t)|(t-1);
            if(ans < m[u][0][0] + m[u][1][0]) ans = m[u][0][0] + m[u][1][0];
        }
        printf("%d\n", ans);
    }
    return 0;
}

Measured memory_bytes: 8064
#include<iostream>
#include<string>
using namespace std;
int main()
{
    string n;
    cin>>n;
    int a=0;
    if(n[0]=='7')
        a++;
    if(n[1]=='7')
        a++;
    if(n[2]=='7')
        a++;
    if(a==0)
        cout<<"No"<<endl;
    else
        cout<<"Yes"<<endl;
}

Measured memory_bytes: 3620
A, B, C, D = map(int, input().split())

T_HP = A
T_AT = B
A_HP = C
A_AT = D
T_count = 0
A_count = 0

while T_HP > 0:
    T_HP -= A_AT
    T_count += 1
while A_HP > 0:
    A_HP -= T_AT
    A_count += 1

if T_count > A_count:
    print('Yes')
elif T_count == A_count:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9044
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        new Main().run();
    }

    private void run() {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int M = scanner.nextInt();

        int[] k = new int[N];
        for(int i = 0; i < N; i++) {
            k[i] = -1;
        }
        int ret = 0;
        for(int i = 0; i < M; i++) {
            int s = scanner.nextInt() - 1;
            int c = scanner.nextInt();
            if(k[s] != -1 && k[s] != c ) {
                ret = -1;
            }
            if(N > 1 && s == 0 && c == 0) {
                ret = -1;
            }
            k[s] = c;
        }
        if(ret == -1) {
            System.out.println(ret);
            return;
        }

        boolean flg = false;

        if(N == 1) {
            if(k[0] == -1) {
                System.out.print(0);
            }else{
                System.out.print(k[0]);
            }
            return;
        } else if(N == 2) {
            if(k[0] == 0) {
                System.out.print(-1);
                return;
            } else if(k[0] == -1) {
                System.out.print(1);
            }else{
                System.out.print(k[0]);
            }

            if(k[1] == -1) {
                System.out.print(0);
            }else{
                System.out.print(k[1]);
            }
            return;

        } else {
            if(k[0] == 0) {
                System.out.print(-1);
                return;
            } else if(k[0] == -1) {
                System.out.print(1);
            }else{
                System.out.print(k[0]);
            }

            if(k[1] == -1) {
                System.out.print(0);
            }else{
                System.out.print(k[1]);
            }

            if(k[2] == -1) {
                System.out.print(0);
            }else{
                System.out.print(k[2]);
            }
        }
    }
}


Measured memory_bytes: 23764
N = gets.chomp.to_i
HS = gets.chomp.split(" ").map(&:to_i)

a = 0
ans = -1
ct = 0
while a < N
  if a + 1 < N && HS[a] >= HS[a + 1]
    ct += 1
    a += 1
    next
  end

  ans = [ans, ct].max
  ct = 0
  a += 1
end

puts ans

Measured memory_bytes: 12036
#include <algorithm>
#include <cstring>
#include <iostream>
#include <vector>

using namespace std;

int main() {
  string s;
  cin >> s;
  int a = stoi(s.substr(0, 2));
  int b = stoi(s.substr(2, 2));
  string ans = "";
  if (a <= 12 && b <= 12 && a > 0 && b > 0) {
    ans = "AMBIGUOUS";
  } else if (a <= 12 && 12 < b && a > 0) {
    ans = "MMYY";
  } else if (12 < a && b <= 12 && b > 0) {
    ans = "YYMM";
  } else if (a == 0 && b <= 12 && b > 0) {
    ans = "YYMM";
  } else if (a > 0 && a <= 12 && b == 0) {
    ans = "MMYY";
  } else {
    ans = "NA";
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
n=gets.to_i
k=1
i=1
s=[]
while k<=100000
  if n==k
    puts "Yes"
    puts i+1
    (i+1).times do
      s << []
    end
    c=0
    cc=i-1
    (i/3).times do |a|
      3.times do |j|
        (i-3*a).times do |b|
          s[3*a+j] << a+cc*j+b+1+c
        end
      end
      s[3*a+2][-1]=s[3*a][3*a]
      (i+1-3*(a+1)).times do |j|
        3.times do |b|
          s[3*(a+1)+j] << s[3*a+b][3*a+j+1]
        end
      end
      c=c+cc*3-1
      cc-=3
    end
    if i%3==1
      s[-2] << c+(i/3)+1
      s[-1] << c+(i/3)+1
    elsif i%3==2
      s[-3] << c+(i/3)+1
      s[-3] << c+(i/3)+2
      s[-2] << c+(i/3)+2
      s[-2] << c+(i/3)+3
      s[-1] << c+(i/3)+3
      s[-1] << c+(i/3)+1
    end
    (i+1).times do |j|
      puts [i,s[j].join(" ")].join(" ")
    end
    exit
  end
  i+=1
  k+=i
end
puts "No"


Measured memory_bytes: 18140
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>
#include <functional>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define EB emplace_back
#define GREATER(T) T, VT<T> greater<T>
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

LL calc(LL A, LL mo) {
    return A / mo;
}

LL calc2(LL A, LL B, LL mo) {
    return calc(B, mo) - calc(A - 1, mo);
}

int main(void) {
    LL A, B, C, D;
    cin >> A >> B >> C >> D;
    cout << (B - A + 1) - calc2(A, B, C) - calc2(A, B, D) + calc2(A, B, C / __gcd(C, D) * D) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <utility>
#include <tuple>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
using ll = long long int;
using P = pair<ll, ll>;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...) do{ } while(false)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template<typename T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }
template<typename T> void print(T a) { cout << a << endl; }
template<typename T, typename... Ts> void print(T a, Ts... ts) { cout << a << ' '; print(ts...); }
template<typename T> istream &operator,(istream &in, T &t) { return in >> t; }
// clang-format on

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin, n;
    string s;
    cin, s;
    auto c = s;
    sort(c.begin(), c.end());
    int cnt = 0;
    REP(i, 0, c.size()) {
        if (c[i] == 'W') {
            break;
        }
        cnt += s[i] == 'W';
    }
    print(cnt);
    return 0;
}


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

// Shrotening
#define fst first
#define snd second
#define pb push_back

// Loop
#define FOR(i,a,b) for(long i=(a);i<(b);++i)
#define RFOR(i,a,b) for(long i=(a);i>=(b);--i)

#define REP(i,a) for(long i=0;i<(a);++i)
#define RREP(i,a) for(long i=(a);i>=0;--i)

#define EACH(i,a) for(auto (i)=(a).begin(),_END=(a).end();i!=_END;++i)
#define REACH(i,a) for(auto (i)=(a).rbegin(),_END=(a).rend();i!=_END;++i)

//Algorithm
#define ALL(a) (a).begin(), a.end()
#define RALL(a) (a).rbegin(), a.rend()
#define EXIST(a,x) ((a).find(x)!=(a).end())
#define SORT(a) std::sort((a).begin(), (a).end())
#define UNIQUE(a) std::sort((a).begin(), a.end()), a.erase(std::unique((a).begin(), a.end()), a.end());
#define SUM(a) std::accumulate((a).begin(), (a).end(), 0);

//Setting
#define OPT std::cin.tie(0);std::ios::sync_with_stdio(false);

//debug message
bool debug = true;
#define MSG(s)   if(debug){std::cout << s << std::endl;}
#define DEBUG(x) if(debug){std::cout << "debug(" << #x << "): " << x << std::endl;}

//alias
typedef long long LL;
typedef std::vector<char> VC;
typedef std::vector<int>  VI;
typedef std::vector<long> VL;
typedef std::vector<long long> VLL;

typedef std::vector< VC > VC2;
typedef std::vector< VI > VI2;
typedef std::vector< VL > VL2;
typedef std::vector< VLL > VLL2;

typedef std::pair<int,int> PII;

std::string a, b;
int main() {
    std::cin >> a >> b;
    std::string s = a + b;

    int prod = std::atoi(s.c_str());
    int sqrt = std::sqrt(prod);

    if(sqrt*sqrt == prod) {
        std::cout << "Yes" << std::endl;
    } else {
        std::cout << "No" << std::endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
//typedef pair<long long,long long> P;
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

long long cnt[51];
long long patti[51];
long long func(int l,long long x){
  if(l==0){
    if(x>0){
      return 1;
    }else{
      return 0;
    }
  }
  long long res=0;
  if(x<=1){
    return 0;
  }
  if(x<=1+cnt[l-1]){
    res = func(l-1,x-1);
    return res;
  }
  res += patti[l-1];
  res += 1;
  res += func(l-1,min(x-(2+cnt[l-1]),cnt[l-1]));
  return res;
}
  
  
int main(){
  int n;
  long long x;
  cin>>n>>x;
  REP(i,n+1){
    if(i==0){
      cnt[i]=1;
      patti[i]=1;
    }else{
      cnt[i]=2*cnt[i-1]+3;
      patti[i]=2*patti[i-1]+1;
    }
  }
  long long ans;
  ans = func(n,x);
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
n=int(input())
l=sorted(list(map(int,input().split())))
cnt=0
for i in range(n):
  for j in range(i+1,n):
    for k in range(j+1,n):
      if l[i]!=l[j] and l[j]!=l[k] and l[i]!=l[k]:
        if l[i]+l[j]>l[k]:
          cnt+=1
print(cnt)

Measured memory_bytes: 67948
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd, log
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

A, B = MAP()

def xor_cal(N):
	if N%4 == 0:
		return N
	elif N%4 == 1:
		return 1
	elif N%4 == 2:
		return N^1
	else:
		return 0

print(xor_cal(B)^xor_cal(A-1))

Measured memory_bytes: 10564
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <iomanip>
#include <sstream>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;

int main() {
	int k; cin >> k;
	cout << (k / 2)*((k + 1) / 2) << endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int C[101][101]={0};
int d[101]={0};
int f[101]={0};
int count = 0;
int n;

void DFS(int i){
  int j;
 
  d[i] = ++count;

  for(j=0; j<n; j++){
    if(C[i][j] != 0 && d[j] == 0)
      DFS(j);
  }

  f[i] = ++count;
}

int main(){

  int i,j,k,v,u;
  int id[101];
  
    scanf("%d",&n);

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

    for(j=0; j<k; j++){
      scanf("%d",&v);
      C[id[i]-1][v-1]=1;
    }
  }

  for(i=0; i<n; i++){
    if(d[i] == 0)
      DFS(i);
  }

  for(i=0; i<n; i++){
    printf("%d %d %d\n",id[i],d[i],f[i]);
  }

  return 0;
}
  



Measured memory_bytes: 2060
#include<iostream>
#include<cmath>
#include<algorithm>
#include <cassert>
#include<string>
using namespace std;
int main(){
	int a = 0, b = 0, c=0, d[100000], e[100000],f=0, count = 0;
	char uc[100000];
	cin >> a>>b;
	cout << a + (b - a)*2 << endl;
		return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main() {
	vector<vector<char> > pic;
	int H, W;
	cin >> H >> W;

	pic.resize(H + 2);
	for (int i = 0; i < H + 2; i++) {
		pic[i].resize(W + 2);
	}
	for (int i = 0; i < H + 2; i++) {
		for (int j = 0; j < W + 2; j++) {
			pic[i][j] = '#';
		}
	}
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> pic[i + 1][j + 1];
		}
	}
	for (int i = 0; i < H + 2; i++) {
		for (int j = 0; j < W + 2; j++) {
			cout << pic[i][j];
		}
		cout << endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=200005;
int n,x,a[N],e[N];
ll sum[N],ans,s;
int main()
{
	scanf("%d%d",&n,&x);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	reverse(a+1,a+n+1);
	for (int i=1;i<=n;i++) sum[i]=sum[i-1]+a[i];
	e[1]=e[2]=5;
	for (int i=3;i<=n;i++) e[i]=e[i-1]+2;
	ans=1e18;
	for (int k=1;k<=n;k++)//取k次 
	{
		s=(ll)(n+k)*x;
		for (int i=1,cnt=1;i<=n;i+=k,cnt++)
		{
		    s+=(ll)(sum[min(i+k-1,n)]-sum[i-1])*e[cnt];
			if (s>ans) break;
		}
		ans=min(ans,s);
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <set>
#include <queue>
#include <stack>
#include <utility>
#include <stdio.h>
#include <unistd.h>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define drep(i, n) for(int i = n - 1; i >= 0; i--)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl
#define PI 3.14159265359

const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const int mod = 1000000007;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}


int main() {
  int n;
  cin >> n;
  map<int, int> mp;
  if (n <= 2) {
    P(n);
    return 0;
  }
  mp[2] = 1;
  for (int i = 3; i <= n; i++) {
    int tmp = i;
    while (tmp != 1) {
      int flag = 1;
      for (auto itr = mp.begin(); itr != mp.end(); itr++) {
        if (tmp % itr->first == 0) {
          flag = 0;
          tmp /= itr->first;
          itr->second++;
          break;
        }
      }
      if (flag == 1) {
        mp[tmp] = 1;
        tmp /= tmp;
      }
    }
  }
  ll ans = 1;
  for (auto itr = mp.begin(); itr != mp.end(); itr++) {
    ans = (ans * (itr->second + 1)) % mod;
    // cout << itr->first << " => " << itr->second << endl;
  }
  P(ans);
  return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
using namespace std;
int judge(vector<int> &a, int k)
{
	for (int i = 2; i < k; ++i) {
		if (a[i] % 2 == 1) {
			return 1;
		}
	}
	return 0;
}
int main()
{
	vector<int> a;
	int aa, bb;
	a.reserve(100);
	while (cin >> aa && cin >> bb) {
		if (aa != 0 && bb != 0) {
			if (max(aa, bb) > a.size()) {
				a.resize(max(aa, bb), 0);
			}
			a[aa - 1] += 1;
			a[bb - 1] += 1;
		}
		else {
			if (a[0] % 2 == 1 && a[1] % 2 == 1 && judge(a, a.size()) == 0) printf("%s\n", "OK");
			else printf("%s\n", "NG");
			a.clear();
		}
	}
}

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

int main() {
	int n;
	cin >> n;
	vector<ll> v(n), w(n);
	v.push_back(0); w.push_back(0);
	rep(i, n) cin >> v[i + 1] >> w[i + 1];
	vector<vector<ll>> dp(1024, vector<ll>(100001));
	// ignore 0
	for(int i = 1; i < min(1024, n + 1); i++) {
		rep(j, w[i]) dp[i][j] = dp[i/2][j];
		for(int j = w[i]; j <= 100000; j++) {
			dp[i][j] = max(dp[i/2][j], dp[i/2][j-w[i]] + v[i]);
		}
	}
	int q;
	cin >> q;
	rep(i, q) {
		int s;
		ll l;
		cin >> s >> l;
		vector<pair<ll, ll>> cand;
		cand.emplace_back(0, l);
		for(; s >= 1024; s /= 2) {
			int prev_sz = cand.size();
			rep(i, prev_sz) {
				ll val, rest;
				tie(val, rest) = cand[i];
				if (rest >= w[s]) cand.emplace_back(val + v[s], rest - w[s]);
			}
		}
		ll ans = 0;
		for(auto p: cand) {
			ll val, rest;
			tie(val, rest) = p;
			chmax(ans, dp[s][rest] + val);
		}
		cout << ans << endl;
	}
}


Measured memory_bytes: 808216
#include <iostream>
#include <map>
using namespace std;
constexpr int max(int a, int b){ return a>b?a:b;}
const int max_size = (int)1e6+5;
int min_factor[max_size] = {0,1,};
int n;
map<long, long> check;

void init(){
    for(int i=2; i < max_size ; ++i) min_factor[i] = i;
    for(int i=2 ; i*i < max_size ; ++i){
        if(min_factor[i] != i) continue;
        for(int multi = 1; multi*i < max_size ; ++multi){
            min_factor[i*multi] = i;
        }
    }
}
int gcd(int a, int b){
    if(b == 0) return a;
    return gcd(b, a%b);
}

int main(){
    init();
    scanf("%d", &n);
    bool no_flag = 0;
    int gcd_num = -1;
    for(int i =0,a ; i <n ; ++i){
        scanf("%d", &a);
        if(gcd_num == -1) gcd_num = a;
        else gcd_num = gcd(gcd_num,a);

        map<int ,int> temp;
        while(a != 1){
            if(a%min_factor[a] == 0 and temp[min_factor[a]] == 0) {
                if(check[min_factor[a]]) no_flag = 1;
                check[min_factor[a]]++;
                temp[min_factor[a]]++;
            }
            a /= min_factor[a];
        }
    }
    int ans = 0;
    if(!no_flag){
        printf("%s", "pairwise coprime");
    }
    else{
        if(gcd_num == 1){
            printf("%s", "setwise coprime");
        }
        else{
            printf("%s", "not coprime");
        }
    }

    return 0;
}

Measured memory_bytes: 12540
from scipy.sparse import*
(n,m,s,*D),*t=[map(int,t.split())for t in open(0)]
R,C=[],[]
r=range(2501)
for u,v,a,b in t[:m]:
    for i in r:
        R+=(i+a)*51+u,(i+a)*51+v
        C+=i*51+v,i*51+u
        D+=b,b
for i,(c,d)in enumerate(t[m:],1):
    for j in r:
        R+=j*51+i,
        C+=(j+c)*51+i,
        D+=d,
d=csgraph.dijkstra(csr_matrix((D,(R,C)),[8**6]*2),1,min(2500,s)*51+1)
for i in range(2,n+1):print(int(min(d[i::51])))

Measured memory_bytes: 123752
// Created by sz
#include <bits/stdc++.h>
using namespace std;

const int maxn = 3005;
typedef  long long  ll;
int N,a[maxn];
ll dp[maxn][maxn];

int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    

    cin>>N;
    for(int i = 0; i<N; i++){
        cin>>a[i];
        dp[i][i] = a[i];
    }

    for (int l=2;l<=N;l++){
        for (int i=0,j=l-1;j<N;i++,j++){
            dp[i][j] = max(a[i] - dp[i+1][j], a[j] - dp[i][j-1]);
        }
    }
    cout<<dp[0][N-1]<<endl;
    return 0;
}






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

int main() {
  int n;
  cin >> n;
  if (n % 10 == 3) cout << "bon" << endl;
  else if (n % 10 == 0 || n % 10 == 1 || n % 10 == 6 || n % 10 == 8) cout << "pon" << endl;
  else cout << "hon" << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()
#define let auto const

i64 dp[62][2][2][2];
i64 dp2[62][2][2][2];

int main() {
  i64 L, R;
  cin >> L >> R;
  L--;
  R++;
  i64 mod = 1e9 + 7;
  dp[61][0][0][0] = 1;
  for(i64 d = 60; d >= 0; d--) {
    for(i64 flag = 0;flag <= 1;flag++) {
      i64 A = ((R >> d) & 1);
      i64 B = ((L >> d) & 1);
      if(flag == 1) A = 1;
      for(i64 next = 0; next <= A; next++) {
        i64 nf = !!(next < A || flag);
        if(next == 0) {
          if(B == next) {
            dp[d][nf][0][0] += dp[d + 1][flag][0][0];
            dp[d][nf][0][0] %= mod;
            dp[d][nf][1][0] += dp[d + 1][flag][1][0];
            dp[d][nf][0][0] %= mod;
          }
          dp[d][nf][1][1] += dp[d + 1][flag][1][1];
          dp[d][nf][1][1] %= mod;
        }
        else {
          if(B == next) {
            dp[d][nf][1][0] += dp[d + 1][flag][0][0] + dp[d + 1][flag][1][0];
            dp[d][nf][1][0] %= mod;
          }
          if(B < next) {
            dp[d][nf][1][0] += dp[d + 1][flag][1][0];
            dp[d][nf][1][0] %= mod;
            dp[d][nf][1][1] += dp[d + 1][flag][0][0] + dp[d + 1][flag][1][0];
            dp[d][nf][1][1] %= mod;
          }
          dp[d][nf][1][1] += dp[d + 1][flag][1][1] * 2;
          dp[d][nf][1][1] %= mod;
        }
      }
    }
  }

  cout << dp[0][1][1][1]  << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
inline long long getnum()
{
    long long now=0;long long fh=1;char ch=getchar();
    while(ch<'0' || ch>'9'){if(ch=='-')fh=-1;ch=getchar();}
    while(ch>='0' && ch<='9'){now=(now<<3)+(now<<1)+ch-'0';ch=getchar();}
    return now*fh;
}
int gcd(int x,int y)
{
  if (x<y)swap(x,y);
  if (y==0)return x;
  return gcd(y,x%y);
}
int n,m,k;
int main()
{
  n=getnum();
  m=getnum();
  k=getnum();
  for (int i=0;i<=n;i++)
  {
    for (int j=0;j<=m;j++)
    {
      if (n*j+m*i-i*j*2==k)
      {
        printf("Yes\n");
        return 0;
      }
    }
  }
  printf("No\n");
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
    
int main()
{
int a;
cin >> a;
if(a % 2 == 0) cout << a/2 << endl;
else cout << (a/2) + 1 << endl;
return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<ctime>

using namespace std;
using ll = long long;

int dfs(int n, int k, vector<vector<int> >&bulb, vector<int>b_sum, vector<int>&p){
  if(n == k){
    for(int i = 0; i < p.size(); i++){
      if(b_sum[i]%2 != p[i]) return 0;
    }
    return 1;
  }
  int ret = 0;
  vector<int> tmp_a = b_sum;
  ret += dfs(n, k+1, bulb, tmp_a, p);
  for(int i = 0 ; i < bulb[k].size(); i++) tmp_a[i] += bulb[k][i];
  ret += dfs(n, k+1, bulb, tmp_a, p);
  return ret;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int ti = clock();
  // start-----------------------------------------------
  int n, m;
  cin >> n >> m;
  vector<vector<int> > bulb(n, vector<int>(m, 0));
  for(int i = 0; i < m; i++){
    int k;
    cin >> k;
    for(int j = 0; j < k; j++){
      int t; cin >> t;
      bulb[t-1][i] = 1;
    }
  }
  vector<int> p(m);
  for(auto &i: p) cin >> i;

  cout << dfs(n, 0, bulb, vector<int>(m, 0), p) << endl;

  // end-----------------------------------------------
  cerr << 1.0 * (clock() - ti) / CLOCKS_PER_SEC << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL (-1)
using namespace std;
const int64_t MOD = 1e9 + 7;

int main() {
	int n;
	cin >> n;
	vector<int> v(n);
	for (int i = 0; i < n; i++) cin >> v.at(i);

	vector<int> S;
	for (int bit = 0; bit < (1 << n); bit++) {
		int sum = 0;
		for (int i = 0; i < n; i++) {
			if (bit & (1 << i)) sum += v.at(i);
		}
		S.push_back(sum);
	}

	int q;
	cin >> q;

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

		cout << (count(S.begin(), S.end(), num) ? "yes" : "no") << endl;
	}
}


Measured memory_bytes: 6940
//INCLUDE
//------------------------------------------
#include <iostream>
#include <functional>
#include <algorithm>
#include <math.h>
#include <iomanip>
#include <string>
#include <cstring>
#include <vector>
//DEFINE
//------------------------------------------
#define ll long long
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
//CONST
//------------------------------------------
#define INF 1010000000000000017LL
#define MOD 1000000007LL
#define EPS 1e-12
#define PI 3.14159265358979323846
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
using namespace std;
//-------------------------------------------
int main(void){
  ll N;cin>>N;
  ll h[N+1];REPS(i,N)cin>>h[i];
  
  vi dp(N+3,INF);dp[1]=0;
  REPS(i,N){
    dp[i+1]=min( dp[i+1],dp[i]+labs(h[i+1]-h[i]) );
    dp[i+2]=min( dp[i+2],dp[i]+labs(h[i+2]-h[i]) );
  }
  cout<<dp[N];
  return 0;
}


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

int main() {
  string a, b;
  cin >> a >> b;
  int A = (a[0] - '0') * 10000 + (a[1] - '0') * 1000 + (a[2] - '0') * 100 + (a[3] - '0') * 10 + (a[4] - '0');
  int B = (b[0] - '0') * 10000 + (b[1] - '0') * 1000 + (b[2] - '0') * 100 + (b[3] - '0') * 10 + (b[4] - '0');

  int cnt = 0;
  for (int i = A; i <= B; i++) {
    if (i / 10000 == i % 10 && i % 10000 / 1000 == i / 10 % 10) 
      cnt++;
  }

  cout << cnt << endl;

  return 0;
}


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

int main() {
  string s, t; int cnt = 0;
  cin >> s;
  cin >> t;
  rep(i, s.length()){
    if(s[i] != t[i]) cnt++;
  }
  cout << cnt << '\n';
}

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

int main() {
  int n, x, y, b, p;
  cin >> n;
  while (cin >> x >> y >> b >> p) {
    int lp = x * b + y * p;
    int cp = (x * (b > 5 ? b : 5) + y * (p > 2 ? p : 2)) * 4 / 5;
    cout << min(lp, cp) << "\n";
  }
}


Measured memory_bytes: 3100
import java.util.Scanner;

public class Main{

    static void isOK(int a, int b, int c, int N, int Y) {
        if(a+b+c == N && (a*10000)+(b*5000)+(c*1000) == Y) {
            System.out.println(a + " " + b + " " + c);
            System.exit(0);
        }
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        int N = scan.nextInt();
        int Y = scan.nextInt();
        int a = 0,b = 0,c;

        c = Y/1000;
        int tmp_c = c;
        isOK(a, b, c, N, Y);
        for(int i = 0; i < tmp_c/5; i++) {
            c -= 5;
            b++;
            if (a + b + c < N) {
                c += 5;
                b--;
                break;
            }
            isOK(a, b, c, N, Y);
        }

        int tmp_b = b;
        for(int i = 0; i < tmp_b/2; i++) {
            b -= 2;
            a++;
            isOK(a, b, c, N, Y);
        }

        System.out.println("-1 -1 -1");

    }
}

Measured memory_bytes: 23252
N,L=map(int,input().split())
li=[]
absli=[]
for i in range(1,N+1):
  li.append(L+i-1)
total=sum(li)
if max(li)<0:
  print(total-max(li))
else:
  li=map(abs,li)
  print(total-min(li))

Measured memory_bytes: 3060
import java.util.*;
import java.util.stream.*;

public class Main {
	Scanner sc;
	int A, B;
	
	public Main() {
		sc = new Scanner(System.in);
	}
	
	private void calc() {
		A = sc.nextInt();
		B = sc.nextInt();
		int add = A + B;
		int sub = A - B;
		int mul = A * B;
		
		out(max(add, max(sub, mul)));
	}
	
	private int max(int a, int b) {
		return (a>b)?a:b;
	}
	
	private void out(Object o) {
		System.out.println(o);
		System.out.flush();
	}
	
	public static void main(String[] args) {
		Main m = new Main();
		m.calc();
	}

}

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

#define rep(i, x, n) for (int i = x; i < n; i++)
typedef long long ll;

const int INF = 1e9 + 7;

using namespace std;

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

	int n;
	cin >> n;

	vector<int> a(n);
	map<int, int> mp;
	rep (i, 0, n) {
		cin >> a[i];
		mp[a[i]]++;
	}

	ll res = 0;
	for (auto it = mp.begin(); it != mp.end(); it++) {
		if (it->first == it->second || it->second == 0)
			continue;

		if (it->first < it->second)
			res += it->second - it->first;
		else
			res += it->second;
	}

	cout << res << endl;
	return 0;
}


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

int main(){

  int N, ans=1;
  cin >> N;
  int d[N];
  for(int i=0; i<N; i++){
    cin >> d[i];
  }

  sort(d, d+N);

  for(int i=1; i<N; i++){
    ans += (d[i] != d[i-1]) ? 1 : 0 ;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int hikaku(int *,int);

int main(){
  int i,n,min,max = -2000000000;;
  int A[200000];

  scanf("%d",&n);

  for(i = 0; i < n; i++){
    scanf("%d",&A[i]);
  }

  min = A[0];

  for(i = 1; i < n; i++){
    if(max < A[i]-min) max = A[i]-min;
    if(min > A[i]) min = A[i];
  }
  printf("%d\n",max);

  return 0;

}
	



Measured memory_bytes: 2580
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<map>
#define MN 100005
using namespace std;
typedef long long ll;
int n,pr[MN],tt,ans;
bool p[MN];
ll a[MN],b[MN];
map<ll,int> mp;
int main(){
	for(int i=2;1ll*i*i*i<=1e10;i++){
		if(!p[i])pr[++tt]=i;
		for(int j=1;j<=tt;j++){
			if(1ll*(i*pr[j])*(i*pr[j])*(i*pr[j])>1e10)break;
			p[i*pr[j]]=1;
			if(i%pr[j]==0)break;
		}
	}scanf("%d",&n);ll x,y,tmp,tmpy;
	for(int i=1;i<=n;i++){
		scanf("%lld",&x);
		for(int j=1;j<=tt;j++)if(1ll*pr[j]*pr[j]*pr[j]<=x){
			tmp=1ll*pr[j]*pr[j]*pr[j];
			while(x%tmp==0)x/=tmp;
		}
		mp[a[i]=x]++;tmp=1;
		for(int j=1;j<=tt;j++)if(1ll*pr[j]*pr[j]*pr[j]<=x)
			if(x%pr[j]==0){
			//	printf("%d ",j);
				tmp*=(x%(pr[j]*pr[j])!=0)?pr[j]*pr[j]:pr[j];
				while(x%pr[j]==0)x/=pr[j];
			}tmpy=(ll)sqrt(x);//printf("%d\n",x);puts("");
		/*printf("%d ",tmp);*/tmp*=(tmpy*tmpy==x)?tmpy:x*x;/*printf("%d\n",tmp);*/b[i]=tmp;
    }
    if(mp[1])ans++,mp[1]=0;
    for(int i=1;i<=n;i++)ans+=max(mp[a[i]],mp[b[i]])/*,printf("x:%lld y:%lld ansx:%d ansy:%d\n",a[i],b[i],mp[a[i]],mp[b[i]])*/,mp[a[i]]=mp[b[i]]=0;
    printf("%d\n",ans);
}

Measured memory_bytes: 14336
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    int k=n%10;
    if(k==2||k==4||k==7||k==5||k==9){

        cout<<"hon"<<endl;
    }
    else if(k==0||k==1||k==6||k==8){

        cout<<"pon"<<endl;
    }
    else if(k==3){

        cout<<"bon"<<endl;
    }








}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ii pair<int,int>
#define ll long long
#define pll pair<ll,ll>
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define iiordered_set tree<pll, null_type,less<pll>, rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
#define MOD (1000*1000*1000+7)
ll power(ll a,ll b, ll m=MOD)
{
    ll res=1;
    while(b>0)
    {
        if(b&1)
            res=(res*a)%MOD;
        a=(a*a)%MOD;
        b>>=1;
    }
    return res;
}
ll inverse(ll a,ll m=MOD)
{
    return power(a,m-2,m);
}
int ceil(int a,int b)
{
    return (a+b-1)/b;
}
#define INFl (1e18+5)
#define vi vector<int>
#define vvi vector<vi>
#define vl vector<long long>
#define vvl vector<vl>
#define vll vector<pll>
#define vii vector<ii>
#define vvii vector<vii>
#define tri pair<int,ii>
#define F first
#define S second
#define forl(i,n) for(int i=0;i<n;i++)
#define fore(i,n) for(int i=1;i<=n;i++)
#define rforl(i,n)  for(int i=n-1;i>=0;i--)
#define rfore(i,n)  for(int i=n;i>=1;i--)
#define CASE(t) cout<<"Case #"<<(t)<<": ";
#define INF 1020000000
#define gcd(a,b) __gcd(a,b)
#define all(x)  x.begin(),x.end()
#define mp make_pair
#define pb push_back
#define print(x)    for(auto it=x.begin();it!=x.end();it++) cout<<*it<<' '; cout<<endl;
#define printii(x)  for(auto it=x.begin();it!=x.end();it++) cout<<it->F<<' '<<it->S<<endl;  
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

int main()
{
	int l;
	cin>>l;
	double x=l/3.0;
	cout<<fixed<<setprecision(20)<<x*x*x<<endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(long long i=0;i<n;++i)
#define REPR(i,n) for(long long i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(long long i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define INF 999999999
#define SUR 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(v) {for(long long sitr=0;sitr<v.size();++sitr){cin>>v[sitr];}}

int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

using namespace std;

typedef pair<int,int> pii;

int dp[3001][3001];

int main(){

  string s, t;
  cin >> s >> t;

  int len_s = s.length(), len_t = t.length();
  REP(i,len_s){
    REP(j,len_t){
      if(s[i] == t[j]){
        //cout << i << " " << j << endl;
        dp[i+1][j+1] = dp[i][j] + 1;
      }else{
        dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j]);
      }
    }
  }

  vector<char> ans;
  int i = len_s, j = len_t;
  while(i > 0 && j > 0){
    if(dp[i][j] == dp[i][j-1]){
      j--;
    }else if(dp[i][j] == dp[i-1][j]){
      i--;
    }else{
      i--;
      j--;
      ans.pb(s[i]);
    }
  }
  int len = ans.size();
  for(int i = len-1; i >= 0; --i){
    cout << ans[i];
  }
  cout << endl;
  return 0;
}



Measured memory_bytes: 35456
#include<stdio.h>
int main(void){
int i=1,n;
scanf("%d",&n);

for(;i<=n;i++){
int x=i;

while(1){
if(x%3==0){
printf(" %d",i);
break;
}
do{
if(x%10==3){
printf(" %d",i);
break;
}
x/=10;
}while(x!=0);
break;
}

}
printf("\n");
return 0;
}


Measured memory_bytes: 1976
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<queue>
#include<stack>
#include<vector>

int main(){
    long long int n,m;
    scanf("%lld %lld",&n,&m);
    if(2*n>=m)printf("%lld",m/2);
    else{
        printf("%lld",(2*n+m)/4);
    }
    
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
long long n,h[100010],dp[100010];

int main()
{
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&h[i]);
	}
	for(int i=2;i<=n;i++)
	{
		if(i-1>=0) dp[i] = dp[i-1]+abs(h[i-1]-h[i]);
		if(i>2)
		{
			
			dp[i] = min(dp[i],dp[i-2]+abs(h[i-2]-h[i]));
		}
	}
	printf("%lld\n",dp[n]);
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
const lint MOD =1000000007;
const lint MAX = 10000000;
using Graph =vector<vector<lint>>;

 
lint fac[MAX], finv[MAX], inv[MAX];

void COMinit() // 二項係数を求める時は前処理としてCOMinit()をする
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint 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;
    }
}
 
// 二項係数計算
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return 0;
        }
    }

    // 素数である
    return 1;
}
lint lcm(lint a,lint b){
      return a/__gcd(a,b)*b;
  }
    lint B1[3000];
    lint B2[3000];
  int main(){
       lint N,M;
       cin>>N>>M;
       if(N==M){
           cout<<"Yes";
           return 0;
       }
       char A[N][N];
       char B[M][M];
       lint count=0;
       rep(i,N){
           rep(j,N){
               cin>>A[i][j];
           }
       }
       rep(i,M){
           rep(j,M){
               cin>>B[i][j];
           }
       }
       rep(i,N-M){
           rep(j,N-M){
               count=0;
           rep(k,M){
               rep(l,M){
                    if(A[i+k][j+l]==B[k][l])count++;
               }
           }
           if(count==M*M){
               cout<<"Yes";
               return 0;
           }
       }
       }
       cout<<"No";
  }
  

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

int main() {

    int n;
    cin >> n;

    priority_queue<long long int> maxq,minq;

    while(n--){

        long long int a;
        cin >> a;

        maxq.push(a);
        minq.push(-a);

    }

    cout << maxq.top() + minq.top() << endl;

    return 0;
}

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

int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  long long n, d;
  cin >> n >> d;
  int ans = 0;
  while(n--) {
    long long x, y;
    cin >> x >> y;
    ans += (x * x) + (y * y) <= d * d;
  }
  cout << ans << '\n';
}

Measured memory_bytes: 3648
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<cstdint>
#include<bits/stdc++.h>
#include<queue>
#include<set>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep_r(i, n) for(int i = n-1; i >= 0; i--)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((ll)(x).size())
#define bit(n) (1LL<<(n))
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define INF bit(60)
#define pb push_back
#define mod 1000000007

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

using namespace std;
using uif=uint_fast64_t;
using ll=long long int;

int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mod;a=1ll*a*a%mod;}while(b>>=1);return ans;}
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


int main(void){
    int n;
cin>>n;
   cout << 180 * (n-2) << endl;

  return 0;

}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include <cmath>
#include <limits>
#include <utility>
#include <map>
#include <iomanip>
#include <queue>
#include <cctype>
#include <stack>


#define rep(p,q) for(int i = p;i < q;i++)
#define ll long long

using namespace std;

//127 C
int main(void) {
	int la, ra,n,m;
	cin >> n >> m;
	la = 1; ra = n;
	rep(0, m) {
		int l,r;
		cin >> l >> r;
		la = max(l, la);
		ra = min(r, ra);
	}
	if (la > ra)cout << 0 << endl;
	else cout << ra - la + 1 << endl;

}

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

const long long INF = 1LL << 60;
const long long divisor = 1000000007;

int main() {
    int N, M;
    cin >> N >> M;
    int a[M];
    for (int i = 0; i < M; i++) cin >> a[i];

    long long dp[N+1];
    for (int i = 0; i <= N; i++) {
        dp[i] = INF;
    }
    dp[0] = 1;
    dp[1] = 1;
    for (int i = 0; i < M; i++) {
        dp[a[i]] = 0;
    }
    for (int i = 2; i <= N; i++) {
        if (dp[i] != 0) {
            dp[i] = dp[i-1] + dp[i-2];
            dp[i] = dp[i] % divisor;
        }
    }

    cout << dp[N] << endl;
    return 0;
}

Measured memory_bytes: 1408