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

using namespace std;

int main(int argc, char *argv[])
{
   
    
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);

    int a,b;
    double d;
    cin >> a >> b;
    cout << a/b << ' ' << a%b << ' ';
    d = (double) a/b;
    cout << fixed << setprecision(5) << d << endl;
    return 0;
}


Measured memory_bytes: 3256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod=1e9+7;

int main(){
    int N;
    cin >> N;
    int A, B;
    cin >> A >> B;
    queue<int> P;
    for(int i=0; i<N; i++){
        int tmp;
        cin >> tmp;
        P.push(tmp);
    }
    int x=0, y=0, z=0;
    while(!P.empty()){
        if(P.front()<=A){
            x++;
        }else if(P.front()<=B){
            y++;
        }else{
            z++;
        }
        P.pop();
    }
    cout << min(min(x,y),z);
}

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

using lli = long long int;

template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

template <class T>ostream &operator<<(ostream &o,const pair<T, T>&p)
{o<<"("<<p.first<<", "<<p.second<<")";return o;}

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

const lli MOD = 1000000007LL;
lli n, a, b;

lli modpow(lli a, lli n){
    lli res = 1;

    for(lli ai = a; n; n>>=1){
        if(1&n) res = (res*ai)%MOD;
        ai=(ai*ai)%MOD;
    }
    return res;
}

lli inv(lli n){
    return modpow(n, MOD-2);
}

lli modperm(lli n, lli k){
    lli res = 1;
    rep(i, k){
        res = (res*(n-i))%MOD;
    }
    return res;
}

lli modcomb(lli n, lli k){
    return (modperm(n, k)*inv(modperm(k, k)))%MOD;
}

lli posmod(lli n){
    lli res = n;
    res %= MOD;
    if(res < 0) res += MOD;
    return res;
}

int main(void){
    //繰り返し二乗法
    //フェルマーの小定理による逆元導出
    cin >> n >> a >> b;
    lli res = posmod(modpow(2, n)-modcomb(n, a)-modcomb(n, b)-1);
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	
	int k=1,ninoinsi=0,N;
	scanf("%d",&N);
	
	while(N>=k){
		k=k*2;
		ninoinsi++;
	}
		
	printf("\n%d\n\n",k/2);
	
	
	return 0;
}

Measured memory_bytes: 256
// A.cpp
// Date: 34:03:16 19 05 2020
// Author: bonelord
#include <bits/stdc++.h>
using namespace std;
#define dbg(x) cerr<<"[("<<__LINE__<<") "<<#x<<" ]: "<<x<<"\n"
#define dbg_arr(x,sz) cerr<<"[("<<__LINE__<<") |"<<sz<<"| "<<#x<<" ]:\n";for(size_t i=0; i<sz; ++i) { cerr<<"["<<i<<"] "<<x[i]<<" "; }cerr<<endl

void solve(){
	int N;
	cin>>N;
	vector<int> h(N+1);
	for (int i = 1; i <= N; ++i){
		cin>>h[i];
	}
	vector<int> dp(N+1);
	dp[2] = abs(h[1] - h[2]);
	for (int i = 3; i <= N; ++i){
		dp[i] = min(dp[i-1] + abs(h[i-1] - h[i]),dp[i-2] + abs(h[i-2] - h[i]));
	}
	cout<<dp[N]<<endl;
}

main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.setf(ios::fixed);

	solve();
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> pii;
const ll mod = 1000000007;
const int MAX_C = 100010;
struct edge {
	int to;
	ll score;
};
vector<edge> e[1002];
void ScoreAttack() {

	ll d[1002];
	int n, m;
	const ll inf = 10e15;
	cin >> n >> m;
	fill(d, d + n + 1, -10e15);
	d[1] = 0;
	map<vector<int>, bool> used;
	for (size_t i = 0; i < m; i++)
	{
		ll a, b, c;
		cin >> a >> b >> c;
		edge eg;
		eg.to = b;
		eg.score = c;
		e[a].push_back(eg);
	}

	priority_queue<pii, vector<pii>> q;
	q.push(pii(0, 1));
	while (!q.empty())
	{
		pii p = q.top();q.pop();
		int v = p.second;
		if (d[v] > p.first) {
			continue;
		}

		for (int i = 0; i < e[v].size(); i++)
		{
			if (d[e[v][i].to] < d[v] + e[v][i].score) {
				if (used.count({ v,e[v][i].to })) {
					if (d[e[v][i].to] < inf) {
						d[e[v][i].to] = inf;

					}
					else continue;
				}
				else {
					used[{v, e[v][i].to}] = true;
					d[e[v][i].to] = d[v] + e[v][i].score;
				}
				q.push(pii(d[e[v][i].to], e[v][i].to));
			}
		}
	}
	cout << (d[n] >= inf ? "inf" : to_string(d[n])) << endl;
}
int main() {

	ScoreAttack();
	return 0;
}


Measured memory_bytes: 512
N=int(input())
s=input()
i_count=0
max_count=0
for i in range(N):
    if s[i]=="I":
        i_count+=1
        if i_count>max_count:
            max_count=i_count
    if s[i]=="D":
        i_count-=1
print(max_count)

Measured memory_bytes: 3060
#include <iostream>
using namespace std;
int main(void){
    int A,B,C,D,P,x,z;
    cin >> A >> B >> C >> D >> P;
    x=P*A;
    if(P<=C){
        if(x>B){
            cout << B << endl;
        }
        else if(x<B){
            cout << x << endl;
        }
    }
    if(P>C){
        z=B+(P-C)*D;
        if(x>z){
            cout << z << endl;
        }
        else if(x<z){
            cout << x << endl;
        }
    }
}



Measured memory_bytes: 3124
#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 INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
using P = pair<int,int>;

int main()
{
  int K;
  cin >> K;
  set<ll> st;
  set<ll> st2;
  REP(i,9){
    st.insert(i+1);
    st2.insert(i+1);
  }
  REP(i,10){
    set<ll> st3;
    for(auto p:st2){
      ll x=p%10;
      ll y=p*10;
      st3.insert(x+y);
      if(x>0){
        st3.insert(x+y-1);
      }
      if(x<9){
        st3.insert(x+y+1);
      }
    }
    st2.erase(ALL(st2));
    for(auto s:st3){
      st2.insert(s);
    }
    for(auto r:st2){
      st.insert(r);
    }
  }

  int j=1;
  for(auto q:st){
    if(j==K){
      cout << q << endl;
      break;
    }
    j++;
  }
}

Measured memory_bytes: 66592
#include <bits/stdc++.h>
#include <cstring> 
using namespace std;
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define mpp make_pair
#define int long long int
#define F first
#define mem(a,b) memset(a,b,sizeof(a))
#define F first
#define S second
#define MOD 998244353
#define in_range(x, y, r, c) (x < r && y < c && x >= 0 && y >= 0)
#define MAXN 2000000
#define MAXI 10000000000007
 
 
signed main(){
 
    fast;
    
    #ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    
    int n, flag=0;
    cin>>n;
    while(n!=0){
    	if(n%10==7)
    		flag=1;
    	n=n/10;
    }
    if(flag)
    	cout<<"Yes"<<endl;
    else
    	cout<<"No"<<endl;
}

Measured memory_bytes: 3608
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979;
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
bool odd(const int &n) { return n & 1; }
bool even(const int &n) { return ~n & 1; }
template<typename T> int len(const T &v) { return v.size(); }
template<typename T = int> T in() { T x; cin >> x; return x; }
template<typename T = int> T in(T &&x) { T z(forward<T>(x)); cin >> z; return z; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &x : v) is >> x; return is; }
template<typename A, typename B> istream &operator>>(istream &is, pair<A, B> &p) { return is >> p.first >> p.second; }
template<typename T> ostream &operator<<(ostream &os, const vector<vector<T>> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : "\n"); return os; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : " "); return os; }
template<typename A, typename B> ostream &operator<<(ostream &os, const pair<A, B> &p) { return os << p.first << ' ' << p.second; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
// clang-format on

class UnionFind {
  vector<int> tree, rank, setSize;

public:
  UnionFind(const int &n) : tree(n), rank(n), setSize(n, 1) { iota(all(tree), 0); }

  int root(const int &x) { return tree[x] == x ? x : tree[x] = root(tree[x]); }

  bool same(const int &a, const int &b) { return root(a) == root(b); }

  bool unite(int a, int b) {
    a = root(a), b = root(b);
    if (a == b) return false;
    if (rank[a] < rank[b]) swap(a, b);
    tree[b] = a;
    setSize[a] += setSize[b];
    if (rank[a] == rank[b]) rank[a]++;
    return true;
  }

  int setSizeOf(const int &x) { return setSize[root(x)]; }

  int size() { return tree.size(); }
};

main() {
  int n = in();
  vector<int> a(n);
  cin >> a;
  UnionFind uf(n);
  loop(i, 1, n) if (a[i - 1] && a[i]) uf.unite(i - 1, i);
  int ans = 0;
  rep(i, n) if (a[i]) cmax(ans, uf.setSizeOf(i));
  cout << ans + 1 << endl;
}



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

R = []
for _ in range(N):
    r = int(input())
    R.append(r)

ri = R[0]

import sys
INT_MIN = sys.maxsize * -1

ans = INT_MIN

for rj in R[1:]:
    ans = max(ans, rj-ri)
    ri = min(ri, rj)
print(ans)


Measured memory_bytes: 15092
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

using boost::multiprecision::cpp_int;
using cpp_dec_float_1000 = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000, boost::int128_type>>;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;
constexpr int MOD = 1000'000'007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }
template<class T> T modinv(T a, T m) { T b = m, u = 1, v = 0; while (b) { T t = a / b; a -= t * b; boost::swap(a, b); u -= t * v; boost::swap(u, v); } u %= m; if (u < 0) u += m; return u; }
template<class T> inline bool isSosuu(const T& n) { if (n == T(1)) { return false; } for (T i = 2; i*i <= n; ++i) { if (n % i == 0) { return false; } } return true; }
template<class T> vector<vector<T>> split (const vector<T>& S, T delim) { vector<vector<T>> ret{}; vector<T> buff{}; for (auto c : S) { if (c == delim) { if (!buff.empty()) ret.push_back(buff); buff.clear(); } else { buff.push_back(c); } } if (!buff.empty()) ret.push_back(buff); return ret; }
template<class T> inline void printYesNo(const T& t) { cout << (t ? "Yes" : "No") << CRLF; }
template<class T = int64_t> T modpow(T N, T P, T M) { T ret{1}; N %= M; while (P) { if (P & 0x01) { ret *= N; ret %= M; } P >>= 1; N *= N; N %= M; } return ret; }

/** code for assert debug begin */
int gErr = 0;
#define ASSERT(p) if(!(p)){ gErr = 1; }else{ ; }
/** code for assert debug end */

struct Tmp
{
public:
  int N;
  Tmp(int N)
  : N(N)
  {}
};

void solve(void)
{
  ll K, A, B; cin >> K >> A >> B;
  ll ans{};
  if (B - A >= 2) {
    auto k = K - (A - 1);
    if (k < 0) {
      ans = K + 1;
    } else {
      ans = A;
      ans += (k / 2) * (B - A);
      ans += k % 2;
    }
  } else {
    ans = K + 1;
  }
  cout << ans << CRLF;
  return;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> ii;
#define F first
#define S second
#define sqr(x) (x)*(x)
#define pb(x) push_back(x)
#define sz(x) (int)x.size()
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,x,y) for(int i=x;i<(y);++i)
#define IOS ios_base::sync_with_stdio(0);cin.tie(0)
/* start */

signed main(){
   IOS;
   int n; cin >> n;
   vector<int> a(n);
   map<int,int> m;  
   int ans = 0;
   rep(i,0,n){
      cin >> a[i];
      m[-a[i]-i]++;
      int c = m[a[i]-i];
      ans+=m[a[i]-i];
   }
   cout << ans << "\n";
}

Measured memory_bytes: 27372
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<climits>
#include<ctime>
#include<cstring>
#include<sstream>
#define REP(i,p,n) for(int i=p;i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define ALL(c) (c).begin(), (c).end()
#define dump(a) cerr << #a << "=" << (a) << endl
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
#define MAX_SIZE 10000

using namespace std;

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

	int t=0;
	int back_time=0;
	bool is_break = false;
	int ans=0;
	while(true) {
		if (t > MAX_SIZE) { break; }
		if (is_break) { break; }
		int time = 60*t + c;

		for(int i=0; i<time; i+=(a+b)) {
			if (i <= time && time <= i+a) {
				ans = time;
				is_break = true;
				break;
			}
		}
		back_time = time;
		t++;
	}
	if (is_break) {
		cout << ans << endl;
	}
	else {
		cout << -1 << endl;
	}


	return EXIT_SUCCESS;
}

Measured memory_bytes: 1164
# coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
#from heapq import heappop, heappush
#from collections import defaultdict
sys.setrecursionlimit(10**7)
import math
#from itertools import product, accumulate, combinations, product
#import bisect
import numpy as np
#from copy import deepcopy
#from collections import deque
#from decimal import Decimal

INF = 1 << 50


def run():
    N, *A = map(int, read().split())
    M = 200003
    P = [0] * (M-1)
    A = [a for a in A if a != 0]
    val2arr = {}
    arr2val = {}
    val = 1
    for p in range(M-1):
        val2arr[val] = p
        arr2val[p] = val
        val *= 2
        val %= M


    for a in A:
        k = val2arr[a]
        P[k] += 1

    L = 1 << (2 * M - 3).bit_length()

    fft_f = np.fft.ifft(np.fft.fft(P, L) ** 2)

    sum = 0
    for i in range(L):
        k = i % (M-1)
        sum += fft_f[i].real * arr2val[k]

    sub = 0
    for a in A:
        sub += (a * a) % M
    print(math.ceil((sum - sub) / 2))



if __name__ == "__main__":
    run()

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

int main() {
  ll N;
  ll cnt=0;
  cin >> N;
  for(int i=1;i<=N;i++){
    if(i%3 != 0 && i%5 != 0){
      //cout << i << endl;
      cnt += i;
    }
  }
  
  cout << cnt << endl;
}


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

using namespace std;

typedef long long ll;

int main()
{
	std::ios::sync_with_stdio(false);
    cin.tie(0);
    string a,b,c;
    cin >> a >> b >> c;
	int la = a.size(),lb = b.size();
	if(a[la-1]==b[0] && b[lb-1]==c[0]){
		cout << "YES" << "\n";
	}else{
		cout << "NO" << "\n";
	}
    
	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++)

const double eps = 1e-10;

struct Point {
  double x, y;
  Point(double x = 0.0, double y = 0.0) : x(x), y(y) {}  
  double norm() {return sqrt(x*x + y*y);}
};

Point operator + (const Point &p, const Point &q) {return Point(p.x + q.x, p.y + q.y);}
Point operator - (const Point &p, const Point &q) {return Point(p.x - q.x, p.y - q.y);}
double operator * (const Point &p, const Point q) {return p.x * q.x + p.y * q.y;}
bool operator == (const Point &p, const Point &q) {return (abs(p.x - q.x) < eps && abs(p.y - q.y) < eps);}
bool operator != (const Point &p, const Point &q) {return !(p == q);}
double cross(const Point &p, const Point &q) {return p.x*q.y - p.y*q.x;}

struct Line_Segment {
  Point p , q;
  Line_Segment(Point p = Point(0.0,0.0), Point q = Point(0.0,0.0)) : p(p), q(q) {}
};

struct Line {
  double a, b, c;
  Line(double a, double b, double c) : a(a), b(b), c(c) {}
  Line(Point p, Point q) {
    a = q.y - p.y;
    b = p.x - q.x;
    c = q.x * p.y - p.x * q.y;
  }
};

struct Circle {
  double r;
  Point p;
  Circle(Point p = Point(0.0, 0.0), double r = 0.0) : p(p), r(r) {}
};

// 点と直線の距離
double point_line_dist(Point p, Line l) {
  return abs(l.a*p.x + l.b*p.y + l.c) / sqrt(l.a*l.a + l.b*l.b);
}

// 点の直線への射影
Point projection (Point p, Line l) {
  double x = p.x - l.a * (l.a*p.x + l.b*p.y + l.c) / (l.a*l.a + l.b*l.b);
  double y = p.y - l.b * (l.a*p.x + l.b*p.y + l.c) / (l.a*l.a + l.b*l.b);
  return Point(x,y);
}

// 線対称な点
Point reflection(Point p, Line l) {
  double x = p.x - 2.0 * l.a * (l.a*p.x + l.b*p.y + l.c) / (l.a*l.a + l.b*l.b);
  double y = p.y - 2.0 * l.b * (l.a*p.x + l.b*p.y + l.c) / (l.a*l.a + l.b*l.b);
  return Point(x,y);
}

// 点の線分からの回転方向
int ccw(Point p, Point p1, Point p2) {
  p1 = p1 - p; p2 = p2 - p;
  if(cross(p1,p2) > eps) return 1; 
  if(cross(p1,p2) < -eps) return -1; 
  if(p1 * p2 < 0) return 2; 
  if(p1.norm() < p2.norm()) return -2; 
  return 0; 
}

// 円と直線の交点
vector<Point> circle_line_cross(Line l, Circle c) {
  vector<Point> vp;
  Point h;
  h.x = c.p.x - l.a * (l.a*c.p.x + l.b*c.p.y + l.c) / (l.a*l.a + l.b*l.b);
  h.y = c.p.y - l.b * (l.a*c.p.x + l.b*c.p.y + l.c) / (l.a*l.a + l.b*l.b);

  double d = l.a*c.p.x + l.b*c.p.y + l.c;
  double q = c.r*c.r - d*d / (l.a*l.a + l.b*l.b);
  if(q >= eps) {
    Point p1, p2;
    p1.x = h.x + sqrt(q) * l.b / sqrt(l.a*l.a + l.b*l.b);
    p1.y = h.y - sqrt(q) * l.a / sqrt(l.a*l.a + l.b*l.b);
    p2.x = h.x - sqrt(q) * l.b / sqrt(l.a*l.a + l.b*l.b);
    p2.y = h.y + sqrt(q) * l.a / sqrt(l.a*l.a + l.b*l.b);
    vp.push_back(p1);
    vp.push_back(p2);
  } else if(abs(q) < eps) {
    vp.push_back(h);
  }
  return vp;
} 

// 線分の交差判定
bool line_segment_cross(const Line_Segment l, const Line_Segment s) {
  return ccw(l.p,l.q,s.p) * ccw(l.p,l.q,s.q) <= 0 && ccw(s.p,s.q,l.p) * ccw(s.p,s.q,l.q) <= 0;
}

int main() {
  Point p1, p2;
  cin >> p1.x >> p1.y >> p2.x >> p2.y;
  Line l(p1,p2);
  int q;
  cin >> q;
  rep(i,q) {
    Point p;
    cin >> p.x >> p.y;
    Point h = reflection(p,l);
    printf("%.9lf %.9lf\n",h.x,h.y);
  }
  return 0;
}






Measured memory_bytes: 3296
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;
    int res = 1;
    for (int b = 2; b * b <= n; ++b) {
        for (int p = b * b; p <= n; p *= b) {
            res = max(res, p);
        }
    }

    cout << res << '\n';

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdlib.h>
#include <math.h>
#include <numeric>

int main() {
	int n, m;

	std::cin >> n >> m;

	std::vector<int> v(n + 1, 0);

	for (size_t i = 0; i < m; i++)
	{
		int a, b;

		std::cin >> a >> b;

		a--;
		b--;

		v[a]++;
		v[b + 1]--;
	}

	for (size_t i = 1; i < n + 1; i++)
	{
		v[i] += v[i - 1];
	}


	int ans = 0;
	for (size_t i = 0; i < n + 1; i++)
	{
		if (v[i] == m) {
			ans++;
		}
	}

	std::cout << ans << std::endl;

	return 0;
}

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

using namespace std;

int main()
{
    long int x, h;
    cin >> x;
    if(x < 500){
        h = (x/5)*5;
    }
    else{
    h = (x / 500)*1000;
    h = h + ((x%500)/5)*5;
    }
    cout<< h << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
  int a,b,i;
  char op;

  for(i=1;i>0;i++){
    scanf("%d %c %d",&a,&op,&b);
      if(op == '?'){
        break;
      }
      else if(op == '+'){
        printf("%d\n",a+b);
      }
      else if(op == '-'){
        printf("%d\n",a-b);
      }
      else if(op == '*'){
        printf("%d\n",a*b);
      }
      else if(op == '/'){
        printf("%d\n",a/b);
      }
  }
  return 0;
}



Measured memory_bytes: 2148
# Aizu Problem 0013: Switching Railroad Cars
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


stack = []
for line in sys.stdin:
    n = int(line)
    if n == 0:
        print(stack.pop())
    else:
        stack.append(n)

Measured memory_bytes: 7616
#include<stdio.h>

int main(void){

    int box[3],N,i,j,k,tmp,result = 0;

    for(i = 0;i < 3;i++){
        scanf("%d",&box[i]);
    }
    scanf("%d",&N);

    for(i = 0;i < 3;i++){
        for(j = i + 1;j < 3;j++){
            if(box[i] > box[j]){
                tmp = box[i];
                box[i] = box[j];
                box[j] = tmp;
            }
        }
    }

    //printf("並び替え後:%d %d %d\n",box[2],box[1],box[0]);

    for(i = 0;i <= N;i++){
        for(j = 0;j <= N;j++){
            k = (N - i * box[2] - j * box[1])/box[0];
            if(i * box[2] + j * box[1] + k * box[0] == N && k >= 0){
                //printf("(%d %d %d)\n",i,j,k);
                result++;
            }
        }
    }

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

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) throws Exception {
		while (true) {
			int N = sc.nextInt();
			int P = sc.nextInt();
			int Q = sc.nextInt();
			if (N == 0) break;
			int start = toMin(P);
			int end = toMin(Q);
			int[] cm = new int[end - start + 1];
			for (int i = 0; i < N; ++i) {
				int K = sc.nextInt();
				for (int j = 0; j < K; ++j) {
					int cms = toMin(sc.nextInt());
					int cme = toMin(sc.nextInt());
					for (int l = Math.max(cms, start); l < Math.min(cme, end); ++l) {
						++cm[l - start];
					}
				}
			}
			cm[end - start] = N;
			int ans = 0;
			int prev = -1;
			for (int i = start; i <= end; ++i) {
				if (cm[i - start] == N) {
					if (prev != -1) {
						ans = Math.max(ans, i - prev);
						prev = -1;
					}
				} else {
					if (prev == -1) prev = i;
				}
			}
			System.out.println(ans);
		}
	}

	static int toMin(int hourmin) {
		return hourmin / 100 * 60 + hourmin % 100;
	}

}

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

#define all(x) (x).begin(), (x).end()
#define li long long
#define itn int

using namespace std;

inline int nxt(){
	int n;
	scanf("%d", &n);
	return n;
}

int gcd(int x, int y){
	while (y){
		x %= y;
		swap(x, y);
	}
	return x;
}

const int mod = 1000000007;

long long pw(long long a, long long b){
	long long res = 1;
	while (b){
		if (b & 1ll)
			res = res * a % mod;
		b >>= 1;
		a = a * a % mod;
	}
	return res;
}

int main(){

	int n = nxt();
	vector<int> a(n);
	for (int i = 0; i < n; i++){
		a[i] = nxt();
	}

	vector<int> b(a);
	sort(all(b));

	set<int> S;
	for (int i = 0; i < n; i += 2)
		S.insert(b[i]);

	int ans = 0;
	for (int i = 0; i < n; i += 2)
		if (S.find(a[i]) == S.end())
			ans++;

	printf("%d\n", ans);

	return 0;
}


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

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

    int x, y, z;
    cin >> x >> y >> z;
    cout << z << " " << x << " " << y << "\n";

    return 0;
}


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


int main(){
    int n, k;   cin >> n >> k;
    vector<ll> h(n);
    for(int i=0; i<n; i++)  cin >> h.at(i);
    sort(h.begin(), h.end());
    ll sum=1e+10;
    for(int i=0; i<n-k+1; i++)
        sum = min(h.at(k-1+i)-h.at(i), sum);

    cout << sum << endl;
}

Measured memory_bytes: 1024
($N,$M,$_,@A)=glob`dd`;//;$s+=$==(($b=$_)+=$b<$'&&$M)-$',$@[$b-1]-=$=,$@[$']++,$@[$b]-=//-$=for@A;@@=map$c+=$_,$c=0,@@for a,b;$%+=$-=$@[$_]+$@[$_+$M]-$%for@A;print$s-$%

Measured memory_bytes: 59076
#include<iostream>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip>//setprecision
#include<math.h>
#include <functional>
#include<climits>
using namespace std;
#define ll  long long 
#define rep(i, n)        for(ll i=0; i<(ll)(n); ++i)
#define mod 1000000007
  vector<ll>to[1000005];
int main(){
  ll a,b,c=0;cin>>a>>b>>c;
  rep(i,min(b-a+1,c))cout<<a+i<<endl;
  for(ll i=max(a+c,b-c+1);i<=b;i++){
    cout<<i<<endl;
  }
}


Measured memory_bytes: 26976
// AOJ 1249: Make a Sequence
// 2017.10.16 bal4u@uu

#include <stdio.h>
#include <string.h>

typedef struct { int x, y; } T;
T a[350];

int n, m;
char peg[8][8][8]; char hi[8][8];

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

int check(int color)
{
	int x, y, z, xx, yy, zz, i, cnt;

	for (x = 0; x < n; x++) for (y = 0; y < n; y++) for (z = 0; z < n; z++) {
		for (i = 0; i < 13; i++) {
			xx = x, yy = y, zz = z, cnt = 0;
			while (0 <= xx && xx < n && 0 <= yy && yy < n &&
				   0 <= zz && zz < n && peg[xx][yy][zz] == color) {
				xx += dx[i], yy += dy[i], zz += dz[i], cnt++;
				if(cnt >= m) return 1;
			}
		}
	}
	return 0;
}

int main()
{
	int p, i, x, y, color;

	while (scanf("%d%d%d", &n, &m, &p) && n > 0) {
		memset(peg, -1, sizeof(peg)); memset(hi, 0, sizeof(hi));
		for (i = 0; i < p; i++) scanf("%d%d", &a[i].x, &a[i].y);
		for (color = 1,i = 0; i < p; i++, color = !color) {
			x = a[i].x-1, y = a[i].y-1;
			peg[x][y][hi[x][y]++] = color;
			if (check(color)) break;
		}
		if (i == p) puts("Draw");
		else printf("%s %d\n", color ? "Black" : "White", i+1);
    }
	return 0;
}

Measured memory_bytes: 1800
/*
  Reference:-
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define forn1(i, n) for (int i = 1; i < int(n); i++)
#define PI pair<int,int>
#define all(vec) vec.begin(),vec.end()
ll mod=1000000007;

int main(){
    std::ios::sync_with_stdio(false);
    ll n,w;
    cin>>n>>w;
    ll N=100001;
    ll ar[n+1][2];
    forn(i,n)cin>>ar[i+1][0]>>ar[i+1][1];
    ll dp[N][n+1];
    memset(dp,0,sizeof(dp));
    forn1(i,N){
        dp[i][0]=INT_MAX;
        forn1(j,n+1){
            dp[i][j]=INT_MAX;
            int dif=i-ar[j][1];
            if(dif>-1)dp[i][j]=min(dp[i][j-1],dp[i-ar[j][1]][j-1]+ar[j][0]);
            else dp[i][j]=dp[i][j-1];
        }
    }
    int ans=0;
    forn1(i,N)if(dp[i][n]<=w)ans=i;
    cout<<ans;

    return 0;
}


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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repr(i, n) for(int i = (n-1); i >= 0; --i)

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

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

const int MAX = 200005;
const int INF = 1001001001;
const int MOD = 1000000007;

int main(){
    rep(i, 5) {
        int x;
        cin >> x;
        if (x == 0) {
            cout << i + 1 << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3564
def dijkstra(ini, goal, g)
  node = Array.new(g.length){Array.new(2,-1)} #最小コスト、確定ノードか否か
  node[ini][0] = 0
  node[ini][1] = -1
  while true
    min = -1
    min_i = -1
    g.length.times do |i|
      if node[i][1] == -1
        min_i = i if (min > node[i][0] || min == -1) && node[i][0] != -1
        min = node[i][0] if (min > node[i][0] || min == -1) && node[i][0] != -1
      end
    end
    if min_i == -1
      break
    end
    node[min_i][1] = 1
    g[min_i].each do |x|
      if node[x[0]][1] == -1
        if node[x[0]][0] == -1 || node[x[0]][0] > node[min_i][0] + x[1]
          node[x[0]][0] = node[min_i][0] + x[1]
        end
      end
    end
  end
  node[goal][0]
end

h,w = gets.chomp.split(" ").map(&:to_i)
c = Array.new(10){Array.new(10)}
10.times do |i|
  c[i] = gets.chomp.split(" ").map(&:to_i)
end
a = Array.new(h){Array.new(w)}
h.times do |i|
  a[i] = gets.chomp.split(" ").map(&:to_i)
end
g = Array.new(10){Array.new}
10.times do |i|
  10.times do |j|
    g[i].push([j,c[i][j]]) if i != j
  end
end
mp = []
10.times do |i|
  mp[i] = dijkstra(i,1,g)
end
ans = 0
h.times do |i|
  w.times do |j|
    ans += mp[a[i][j]] if a[i][j] != -1
  end
end
puts ans

Measured memory_bytes: 15012
#include <iostream>
#include <vector>
using namespace std;
using Graph = vector<vector<int>>;

// 深さ優先探索
vector<bool> seen;
void dfs(const Graph &G, int v) {
    seen[v] = true;
    for (int next_v : G[v]) {
        if (seen[next_v]) continue;
        dfs(G, next_v); // 再帰的に探索
    }
}

int main() {
    // 頂点数と辺数
    int N, M; cin >> N >> M;

    // グラフ入力受取
    Graph G(N);
    for (int i = 0; i < M; ++i) {
        int a, b;
        cin >> a >> b;
        G[a-1].push_back(b-1);
        G[b-1].push_back(a-1);
    }

    // 全頂点が訪問済みになるまで探索
    int count = 0;
    seen.assign(N, false);
    for (int v = 0; v < N; ++v) {
        if (seen[v]) continue; // v が探索済みだったらスルー
        dfs(G, v); // v が未探索なら v を始点とした DFS を行う
        ++count;
    }
    cout << count-1 << endl;
}


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

int main()
{
    long long a;
    string b;
    cin>>a>>b;
    long long c = (b[0]-'0')*100+(b[2]-'0')*10+(b[3]-'0');
    cout<<(a*c)/100<<endl;
    return 0;
}

Measured memory_bytes: 3624
#include<stdio.h>

int main(){
  int A,B,C;
  scanf("%d %d %d",&A,&B,&C);
  
  if(A==B){
    printf("%d\n",C);
  }else if(A==C){
    printf("%d\n",B);
  }else{
    printf("%d\n",A);
  }
  
  return 0;
}

Measured memory_bytes: 128
import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {

    static class Task {

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int k = in.nextInt();
            String s = in.next();
            int len = s.length();
            if (len <= k) {
                out.println(s);
            } else {
                out.println(s.substring(0, k) + "...");
            }
        }
    }

    private static void sort(double[] arr) {
        Double[] objArr = Arrays.stream(arr).boxed().toArray(Double[]::new);
        Arrays.sort(objArr);
        for (int i = 0; i < arr.length; i++) {
            arr[i] = objArr[i];
        }
    }

    private static void sort(int[] arr) {
        Integer[] objArr = Arrays.stream(arr).boxed().toArray(Integer[]::new);
        Arrays.sort(objArr);
        for (int i = 0; i < arr.length; i++) {
            arr[i] = objArr[i];
        }
    }

    private static void sort(long[] arr) {
        Long[] objArr = Arrays.stream(arr).boxed().toArray(Long[]::new);
        Arrays.sort(objArr);
        for (int i = 0; i < arr.length; i++) {
            arr[i] = objArr[i];
        }
    }

    private static void solve() {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task task = new Task();
        task.solve(1, in, out);
        out.close();
    }

    public static void main(String[] args) {
        new Thread(null, () -> solve(), "1", 1 << 26).start();
    }

    static class InputReader {

        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

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

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

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

    }

}

Measured memory_bytes: 36684
n,m=map(int,input().split())
s=[list(map(int,input().split())) for i in range(m)]
p=list(map(int,input().split()))
ans = 0

for i in range(2**n):
  ans += 1
  for j in range(len(s)):
    on = 0
    for k in range(s[j][0]):
      on += ((i>>(s[j][k+1]-1))%2)
    if(on%2 != p[j]):
      ans -= 1
      break
      
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <string>
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <sstream>
#include <stack>
#include <iomanip>
#include <assert.h>
using namespace std;
#define pb push_back
#define mp make_pair
typedef pair<int,int> pii;
typedef long long ll;
typedef double ld;
typedef vector<int> vi;
#define fi first
#define se second
#define fe first
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define Edg int M=0,fst[SZ],vb[SZ],nxt[SZ];void ad_de(int a,int b){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;}void adde(int a,int b){ad_de(a,b);ad_de(b,a);}
#define Edgc int M=0,fst[SZ],vb[SZ],nxt[SZ],vc[SZ];void ad_de(int a,int b,int c){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;vc[M]=c;}void adde(int a,int b,int c){ad_de(a,b,c);ad_de(b,a,c);}
#define es(x,e) (int e=fst[x];e;e=nxt[e])
#define esb(x,e,b) (int e=fst[x],b=vb[e];e;e=nxt[e],b=vb[e])
const int MOD=1e9+7;
#define SZ 1234567
int n;
char s[SZ];
int C(int a,int b)
{
	if(a<2&&b<2)
		return (a>=b);
	return C(a/2,b/2)*C(a&1,b&1);
}
int t[SZ];
int main()
{
	scanf("%d%s",&n,s+1);
	int ans=0,ev=1;
	for(int i=1;i<=n;++i)
		ans^=s[i]*C(n-1,i-1);
	if(ans&=1) cout<<1;
	else
	{
		--n;
		for(int i=1;i<=n;++i)
			t[i]=abs(s[i]-s[i+1]);
		bool ok=1;
		for(int i=1;i<=n;++i)
			if(t[i]&1) ok=0;
		if(ok)
		{
		ans=0,ev=1;
		for(int i=1;i<=n;++i)
			ans^=(t[i]/=2)*C(n-1,i-1);
		if(ans&=1) cout<<2;
		else cout<<0;
		}
		else cout<<0;
	}
}


Measured memory_bytes: 5376
x,y,z,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=sorted(list(map(int,input().split())),reverse=True)
ab=[]
for i in a:
    for j in b:
        ab.append(i+j)
ab.sort(reverse=True)
ans=[]
for i in range(min(k,len(ab))):
    for j in range(min(k,len(c))):
        ans.append(ab[i]+c[j])
ans.sort(reverse=True)
for i in range(k):
    print(ans[i])


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll A, B; cin >> A >> B;
    if ((A + B) % 2 == 0){cout << (A + B) / 2 << endl;}else{cout << "IMPOSSIBLE" << endl;}
}

int main() {

    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


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

int main() {
  int N,K;
  string S;
  char X = '*',t;
  cin >> N>>S>>K;  
  K--;
  char Y = S.at(K);

  
  
  for(int i=0;i<N;i++){
    t = S.at(i);
    if(t != Y){
     S.at(i) = X; 
    }
  }
  
  cout << S <<endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		List<Integer> inputList = new ArrayList<Integer>();
		while(true) {
			if (inputList.size() > 10000) {
				break;
			}
					
			int num = Integer.parseInt(br.readLine());
			
			if (num == 0) {
				break;
			}
			
			if (!(num >= 1 && num <= 10000)) {
				throw new IllegalArgumentException();
			}
				
			inputList.add(num);
		}
		
		for (int i = 0; i < inputList.size(); i++) {
			System.out.println("Case " + (i + 1) + ": " + inputList.get(i));
		}
	}
}

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

int main()
{
	int A[3];
	cin >> A[0] >> A[1] >> A[2];
	sort(A, A + 3);
	if (A[0] == 5 && A[1] == 5 && A[2] == 7)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <deque>
#include <fstream>
#include <iostream>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stdio.h>
#include <string>
#include <vector>

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define POW(n) ((n) * (n))
#define ALL(a) (a).begin(), (a).end()

using namespace std;

namespace Dump {
#define dump(...) Dump::print(#__VA_ARGS__, __VA_ARGS__)
static std::vector<string> dumpKey;
static string dumpKeyBuf;

void print() { cerr << endl; }
template <class Head, class... Tail> void print(Head &&head, Tail &&... tail) {
  if (dumpKey.empty()) {
    dumpKeyBuf = head;
    dumpKeyBuf.erase(std::remove_if(dumpKeyBuf.begin(), dumpKeyBuf.end(),
                                    [](char c) { return c == ' '; }),
                     dumpKeyBuf.end());

    std::istringstream stream(dumpKeyBuf);
    string field;
    while (std::getline(stream, field, ','))
      dumpKey.push_back(field);

    reverse(dumpKey.begin(), dumpKey.end());
  } else {
    cerr << dumpKey.back() << ":" << head << "  ";
    dumpKey.pop_back();
  }
  Dump::print(std::move(tail)...);
}
}

typedef long long ll;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<long long> vll;
typedef vector<unsigned long long> vull;
typedef pair<int, int> pii; // p.first p.second

// ll n = to_T<ll>("114514")
template <class T> T to_T(const string &s) {
  istringstream is(s);
  T res;
  is >> res;
  return res;
}
template <class T> string to_s(const T &a) {
  ostringstream os;
  os << a;
  return os.str();
}

ll L[40];

void solve(long long N, long long K, vector<long long> A, vector<long long> B) {
  vll index;
  index.push_back(K);

  FOR(i, 1, 31) {
    if ((1 << i) & K) {
      index.push_back((K - (1 << i)) | ((1 << i) - 1));
      // dump(i, index.back());
    }
  }

  REP(i, N) {
    REP(j, index.size()) {
      bool f = (index[j] | A[i]) == index[j];
      if (f) {
        L[j] += B[i];
        // dump(index[j], B[i], f);
      }
    }
  }

  ll ans = 0;
  REP(i, 31) { ans = max(ans, L[i]); }

  cout << ans << endl;
}

int main() {
  ios::sync_with_stdio(false);
  long long K;
  long long N;
  cin >> N;
  vector<long long> B(N - 1 + 1);
  vector<long long> A(N - 1 + 1);
  cin >> K;
  for (int i = 0; i <= N - 1; i++) {
    cin >> A[i];
    cin >> B[i];
  }
  solve(N, K, A, B);
  return 0;
}


Measured memory_bytes: 3456
import math
def show_vertex(x,y):
    print("%.8f %.8f" % (x,y))
def koch(x0,y0,x1,y1,n):
    if n == 0:
        show_vertex(x0,y0)
    else:
        c1 = [(2*x0+x1)/3,(2*y0+y1)/3]
        c3 = [(x0+2*x1)/3,(y0+2*y1)/3]
        c2 = [(3*(x1+x0) -(y1-y0)*math.sqrt(3))/6,((x1-x0)*math.sqrt(3)+3*(y1+y0))/6]
        koch(x0,y0,c1[0],c1[1],n-1)
        koch(c1[0],c1[1],c2[0],c2[1],n-1)
        koch(c2[0],c2[1],c3[0],c3[1],n-1)
        koch(c3[0],c3[1],x1,y1,n-1)
N = int(input())
koch(0,0,100,0,N)
show_vertex(100,0)



Measured memory_bytes: 5740
n,m = map(int,input().split())
h = list(map(int,input().split()))
l = [list(map(int,input().split())) for i in range(m)]
a,b = [list(i) for i in zip(*l)]
z = [1] * n

for i in range(m):
    x = a[i] - 1
    y = b[i] - 1
    if h[x] < h[y]:
        z[x] = 0
    elif h[x] > h[y]:
        z[y] = 0
    else:
        z[x] = 0
        z[y] = 0

print(n - z.count(0))

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

using namespace std;

typedef long long ll;

const int INF = 1000000000;

int main()
{
  int N;
  scanf("%d", &N);
  vector<vector<int> > board(2, vector<int>(N, 0));
  for (int i = 0; i < 2; ++i) {
    for (int j = 0; j < N; ++j) {
      scanf("%d", &board[i][j]);
    }
  }
  int ans = 0;
  for (int pos = 0; pos < N; ++pos) {
    int sum = accumulate(board[0].begin(), board[0].begin() + pos + 1, 0);
    sum += accumulate(board[1].begin() + pos, board[1].end(), 0);
    ans = max(ans, sum);
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace task
{
    class Program
    {
        static void Main(string[] args)
        {
            bool ifOk = true;
            int n = Convert.ToInt32(Console.ReadLine());
            int[] m = Array.ConvertAll(Console.ReadLine().Split(' '), a => Convert.ToInt32(a));
            for (int i = n - 1; i > 0; i--)
            {
                if (m[i - 1] <= m[i]) ;
                else if (m[i - 1] - 1 <= m[i])
                {
                    m[i - 1] -= 1;
                }
                else
                {
                    ifOk = false;
                    break;
                }
            }
            if (ifOk) Console.WriteLine("Yes");
            else Console.WriteLine("No");
        }
    }
}


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

typedef long long ll;

long long x[100005];
long long y[100005];

const ll mod = (ll)1e9+7;

ll mul(ll a, ll b)
{
	return (a*b)%mod;
}

int main()
{
	int n,m;
	scanf("%d %d",&n,&m);
	for(int i = 0 ; i < n ; i++)
	{
		scanf("%lld",&x[i]);
	}
	for(int i = 0 ; i < m ; i++)
	{
		scanf("%lld",&y[i]);
	}

	ll a = 0, b = 0;

	for(int i = 0; i < n ; i++)
	{
		a += mul(x[i],i) - mul(x[i], n-i-1);
		a += mod;
		a %= mod;
	}
	for(int i = 0; i < m ; i++)
	{
		b += mul(y[i],i) - mul(y[i], m-i-1);
		b += mod;
		b %= mod;
	}
	printf("%lld\n",mul(a,b));
	return 0;
}


Measured memory_bytes: 1792
#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() {
    long double a, b, h, m;
    cin >> a >> b >> h >> m;
    long double th = abs(h * 60 - m * 11) / 360 * M_PI;
    cout << setprecision(10) << sqrt(a * a + b * b - 2.0 * a * b * cosl(th));
    return 0;
}

Measured memory_bytes: 4168
#include <stdio.h>
#include <string.h>

int n;
char str[105][16];

int main()
{
    int i, j;
    char prev;
    int f = 1;
    
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        scanf("%s", str[i]);
    }


    prev = str[0][strlen(str[0]) - 1];
    i = 1;
    while (i < n && f) {
        for (j = 0; j < i; j++) {
            if (strcmp(str[i], str[j]) == 0) {
                f = 0;
            }
        }

        if (prev != str[i][0]) {
            f = 0;
        }
        
        prev = str[i][strlen(str[i]) - 1];

        i++;
    }

    if (i < n || !f) {
        printf("No\n");
    } else {
        printf("Yes\n");
    }
        
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>

#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 SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define m0(x) memset(x,0,sizeof(x))
//#define fill(x,y) memset(x,y,sizeof(x))
#define print(x) cout<<x<<endl;
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
#define ub(v,n) upper_bound(v.begin(), v.end(), n);
//#define int long long
#define all(x) (x).begin(), (x).end()

using namespace std;
typedef pair<int, int>P;

int dy[4] = { 0,0,1,-1 };
int dx[4] = { 1,-1,0,0 };
int dxx[8] = { 0,0,1,1,1,-1,-1,-1 };
int dyy[8] = { 1,-1,0,1,-1,0,1,-1 };


const int MAX = 500010;
const int MOD = 1000000007;
const ll INF = 1e17;
const double pi = acos(-1);
const double EPS = 1e-10;




ll cum[1010];//累積和
vector<ll>score;
int N, K;

vector<ll> dfs(int n,vector<ll>use) {
	int cnt = 0;//n番目のビットが立っている数の個数
	if (use.size() == K)return use;//もし残っている数がK個になればそれ以上減らせないので打ち切る

	for (auto x : use) {
		if (x&(1LL << n))cnt++;//k番目のビットが立っていればcntをインクリメント
	}

	vector<ll>nuse;//n番目のビットが立っている数を入れるvector

	if (cnt >= K) {
		for (auto x : use) {
			if (x&(1LL << n)) {
				nuse.pb(x);//n番目のビットが立っているものを残して他は捨てる
			}
		}
		if (n == 0)return nuse;
		return dfs(n - 1, nuse);
	}

	if (n == 0)return use;
	return dfs(n - 1, use);
}


signed main() {
	cin >> N >> K;
	cum[0] = 0;

	REP(i, N) {
		int a; cin >> a;
		cum[i + 1] = cum[i] + a;
	}

	REP(i, N) {
		for (int j = i+1; j <= N; j++) {
			score.pb(cum[j] - cum[i]);//部分列の組み合わせを全列挙
		}
	}
	/*for (auto x : score) {
		print(x);
	}cout << endl;*/
	vector<ll>use = dfs(50, score);//部分和のmaxは10^9*10^3<2^50なのでn=50から始める
	VSORT(use); VREVERSE(use);
	ll ans = use[0];
	/*for (int i = 1; i < K; i++) {
		ans = ans & use[i];
	}*/

	for (auto x : use) {
		ans = ans & x;
	}
	print(ans);
}

Measured memory_bytes: 68204
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100010;
const int64_t INF = (1LL << 62);
vector<int64_t> to[MAXN];
vector<vector<int64_t>> steps(3, vector<int64_t>(MAXN, INF));

int main()
{
  int64_t N, M, u, v, S, T;
  cin >> N >> M;
  for (int i = 0; i < M; i++)
  {
    cin >> u >> v;
    u--, v--;
    to[u].push_back(v);
  }
  cin >> S >> T;
  S--, T--;
  queue<pair<int64_t, int64_t>> Q;
  Q.push({S, 0});
  while (Q.size())
  {
    int64_t cur = Q.front().first, step = Q.front().second;
    Q.pop();
    for (auto v : to[cur])
    {
      if (steps[(step + 1) % 3][v] != INF)
        continue;
      steps[(step + 1) % 3][v] = step + 1;
      Q.push({v, step + 1});
    }
  }
  cout << (steps[0][T] == INF ? -1 : steps[0][T] / 3) << endl;
}

Measured memory_bytes: 10876