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

using namespace std;

typedef long long ll;
typedef long long unsigned int llui;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< vector<int> > vvi;
typedef set<int> si;
typedef map<string, int> msi;
typedef map<int, int> mii;

#define INF 1000000000
#define MOD 1000000007
#define EPS 1e-9
#define DEBUG(x) cout<< '>' << #x << ':' << x << "\n";
#define ALL(x) (x).begin(), (x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define UNIQUE(x) SORT(x),(x).erase(unique((x).begin(),(x).end()),(x).end())
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define SZ(a) int((a).size())
#define CLR(a) memset(a,0,sizeof(a))
#define SET(a,b) memset(a,b,sizeof(a))

#define FOR(i,a,b) for (int i = int(a); i < int(b); i++)
#define FORD(i,a,b) for(int i=int(b)-1; i>=int(a); i--)
#define REP(i, n) for (int i = 0; i < int(n); i++)
#define REP1(i,n) for (int i = 1; i <= int(n); i++)
#define REV(i, n) for (int i = int(n)-1; i >=0 ; i--)

#define sd(n) scanf("%d",&n)
#define dsd(n) int n; scanf("%d",&n)
#define sd2(a,b) scanf("%d%d",&a,&b)
#define dsd2(a,b) int a,b; scanf("%d%d",&a,&b)
#define pd(n) printf("%d\n",n)
#define pds(n) printf("%d ",n)
#define sll(n) scanf("%lld",&n)
#define dsll(n) ll n; scanf("%lld",&n)
#define sll2(a,b) scanf("%lld%lld",&a,&b)
#define dsll2(a,b) ll a,b; scanf("%lld%lld",&a,&b)
#define pll(n) printf("%lld\n",n)	
#define plls(n) printf("%lld ",n)	
#define print(x) cout<< x << "\n"

#define trace(x) cout << '>' << #x << ':' << x << "\n"
#define trace2(x,y) cout<< '>' << #x << ':' << x << " | " << #y << ':' << y << "\n"
#define trace3(a,b,c) cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define trace4(a,b,c,d) cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"

inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }

#define LSOne(S) (S&(-S))

const double pi = acos(-1);
const int oo = 0x3f3f3f3f;

int cmp(double x, double y = 0, double tol = EPS) {
    return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1;
}

/////////////////////////////////////////////////////////////////////

const int MAX_N = 1000010;
//int arr[MAX_N];

int main(){
    vi V(4);
    REP(i,3){
        dsd2(x,y);
        x--;y--;
        V[x]++,V[y]++;
    }
    REP(i,4) if(V[i]>2) return !printf("NO\n");
    printf("YES\n");
	return 0;
}


Measured memory_bytes: 256
from math import sqrt

n = int(input())
orig_n = n

factor = []

i = 2
while i <= sqrt(n):
    if n % i == 0:
        factor.append(i)
        n //= i
    else:
        i += 1

if n != 1:
    factor.append(n)

res = f'{orig_n}: ' + ' '.join(map(str, factor))

print(res)


Measured memory_bytes: 5676
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr=input.trim().split("\n");
var [n,c]=arr[0].split(" ").map(Number);
var p=arr[1].split(" ").map(Number);
var sum=p.reduce((a,b)=> a+b);
var x=(sum%(n+1)==0)?0:1;
console.log(Math.floor(sum/(n+1))+x);


Measured memory_bytes: 19244
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
using IP = pair<int, int>;

const ll linf = 1LL << 62;
const int inf = 99999999;
const int dx[4] = { 1,0,-1,0 };
const int dy[4] = { 0,1,0,-1 };
const ll atcoder = 1e9 + 7;

#define Endl endl
#define mp make_pair
#define all(v) v.begin(),v.end()
#define pb push_back
#define pr(x) cout << x << endl
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
#define rep(i,n) for(int i= 0;i<n;i++)

template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}

ll gcd(ll a, ll b) {//最大公約数
	if (a < b)swap(a, b);
	if (a%b == 0)return b;
	else gcd(b, a%b);
}

ll lcm(ll a, ll b) {//最小公倍数
	if (a < b)swap(a, b);
	return (a / gcd(a, b))*b;
}

int ch[50][100010] = { 0 };

int main() {

	int n, c;
	cin >> n >> c;

	rep(i, n) {
		int s, t, c;
		cin >> s >> t >> c;
		ch[c-1][s - 1]++;
		ch[c-1][t]--;
	}

	rep(i, c) rep(j, 100000) ch[i][j + 1] += ch[i][j];
	
	int ans = -inf;

	rep(j, 100001) {
		int cnt = 0;
		rep(i, c) if (ch[i][j] > 0)cnt++;
		chmax(ans, cnt);
	}

	pr(ans);

	//system("pause");
	return 0;
}

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

inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
const long long INF = 1LL << 60;
int cnt = 0;
int main()
{
    int n, a;
    cin >> n >> a;

    if (n % 500 <= a)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3552
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
static const double EPS = 1e-5;

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

int main(void){
  int n;
  bool f = false;
  while(cin>>n){
    if(n==0) break;
    if(f)cout<<endl;
    else f=true;
    vector<pair<PII,string> > data;
    REP(i,n){
      string team;
      int win,tmp;
      cin>>team;
      cin>>tmp;
      win=tmp*3;
      cin>>tmp;
      cin>>tmp;
      win+=tmp;
      data.push_back(pair<PII,string>(PII(-win,i),team));
    }
    sort(data.begin(),data.end());
    REP(i,n){
      printf("%s,%d\n",data[i].second.c_str(),-data[i].first.first);
    }
  }


  return 0;
}

Measured memory_bytes: 0
// #include <bits/stdc++.h>
// #define SIZE 300005
// #define MOD 1000000007LL
// #define INF 1 << 30
// #define LLINF 1LL << 60
// #define REP(i,n) for(int i=0;i<n;i++)
// #define FOR(i,a,b) for(int i=a;i<=b;i++)
// #define DOWN(i,b,a) for(int i=b;i>=a;i--)
// #define SET(a,c) memset(a,c,sizeof a)
// #define BIT(i,j) ((i)>>(j))&1
// #define ALL(o) (o).begin(), (o).end()
// #define ERASE(o) (o).erase(unique((o).begin(),(o).end()), (o).end())
// #define SQ(x) ((x)*(x))
// using namespace std;
// typedef long long ll;
// typedef pair<ll,ll> Pll;
// typedef pair<int, int> Pii;
// typedef pair<double, double> Pdd;
// typedef complex<double> dcomplex;
// template<typename T> inline void priv(vector<T>a){REP(i,a.size()){cerr<<a[i]<<((i==a.size()-1)?"\n":" ");}}
// ll gcd(ll a,ll b){int c=max(a,b);int d=min(a,b);return c==0||d==0?c:gcd(c%d,d);}
// ll lcm(ll a,ll b){return a==0||b==0?0:a*b/gcd(a,b);}
// ll fact(ll a){ll b=1;FOR(i,1,a)b*=i;return b;}

#include <bits/stdc++.h>
#define MOD 1000000007LL
#define C1  401
#define C2  397
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)

typedef long long ll;

using namespace std;

int h,w,r,c;

vector<vector<ll> > genHash(const vector<string> v, int xs, int ys)
{
  vector<vector<ll> > h1(xs,vector<ll>(ys,0));
  vector<vector<ll> > h2(xs,vector<ll>(ys,0));
  ll cn1 = 1, cn2 = 1;
  REP(i,c) cn1 = (cn1*C1)%MOD;
  REP(i,r) cn2 = (cn2*C2)%MOD;
  REP(i,xs)
  {
    ll h = 0;
    REP(j,c) h=(h*C1+v[i][j])%MOD;
    REP(j,ys-c+1)
    {
      h1[i][j] = h;
      if(j+c<ys) h = (h*C1-v[i][j]*cn1+v[i][j+c])%MOD;
      h = (h<0)?h+MOD:h;
    }
  }
  REP(j,ys)
  {
    ll h = 0;
    REP(i,r) h=(h*C2+h1[i][j])%MOD;
    REP(i,xs-r+1)
    {
      h2[i][j] = h;
      if(i+r<xs) h = (h*C2-h1[i][j]*cn2+h1[i+r][j])%MOD;
      h = (h<0)?h+MOD:h;
    }
  }
  return h2;
}

int main()
{
  cin >> h >> w;
  vector<string> a(h);
  REP(i,h) cin >> a[i];
  cin >> r >> c;
  vector<string> b(r);
  REP(i,r) cin >> b[i];
  if(h<r||w<c) return 0;
  auto f = genHash(a,h,w);
  auto p = genHash(b,r,c);
  REP(i,h-r+1) REP(j,w-c+1) if(f[i][j] == p[0][0])
    printf("%d %d\n",i,j);
  return 0;
}

Measured memory_bytes: 28384
// inputに入力データ全体が入る
function Main(input) {
  
   input = input.split("\n");
  var n= parseInt(input[0], 10);
 
   var tmp = input[1].split(" ");
     var a = [];
for (var i = 0; i <n ; i++){
  var r= parseInt(tmp[i], 10);
 
  a[i] = r;}
  
 //console.log(a);
 
 var t = 0;
  for ( i = 0;i < n ;i++){var t = t + 1/tmp[i];}
  
  var k = 1 / t ;
  console.log(k);
                          
 
  
}
 
  
  //*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
  

Measured memory_bytes: 7372
#include <iostream>
#include <string>
#include <stack>

using namespace std;

string hoge;
string hogehoge;
stack<char> foo;

int main(void){

  while(1){

    while( !(foo.empty() ) ){
      foo.pop();
    }

    getline( cin , hoge );
    if( hoge == "." )break;

    hogehoge = "";
    for( int i = 0 ; i < hoge.size() ; i++ ){
      if( hoge[i] == '[' || hoge[i] == ']' || hoge[i] == '(' || hoge[i] == ')' ){
	hogehoge += hoge[i]; 
      }
    }

    for( int i = 0 ; i < hogehoge.size() ; i++ ){
      if(hogehoge[i] == '[' ) foo.push(hogehoge[i]);      
      if(hogehoge[i] == '(' ) foo.push(hogehoge[i]);
      if(hogehoge[i] == ']' ){
	if( !( foo.empty() ) && foo.top() == '[' ){
	  foo.pop();
	}
	else goto bad;
      } 
      if(hogehoge[i] == ')' ){
        if( !(foo.empty())  && foo.top() == '(' ){
          foo.pop();
        }
        else goto bad;
      }
    }
    if( foo.empty() ){
    cout << "yes" << endl;
    continue;
    }
  bad:
    cout << "no" << endl;
  }
  return 0;
}

Measured memory_bytes: 1180
#include <bits/stdc++.h>
using namespace std;
int main() {
  int x;
  cin >> x;
  
  int y,z,a;
  y = x/500;
  z = x%500;
  a = z/5;
  
  cout << y*1000+a*5;
  
  return 0;
}

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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  cout << min(a * b, min(b * c, c * a)) / 2 << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  int n; cin >> n;
  vector<int> a(n), b(n);
  REP(i, n) cin >> a[i];
  REP(i, n) cin >> b[i];
  int ans = 0;
  REP(bit, 29) {
    vector<int> B(n);
    REP(i, n) B[i] = b[i] & ((1 << (bit + 1)) - 1);
    sort(ALL(B));
    int t = 1 << bit;
    ll cnt = 0;
    REP(i, n) {
      int A = a[i] & ((1 << (bit + 1)) - 1);
      cnt += lower_bound(ALL(B), t * 2 - A) - lower_bound(ALL(B), t - A);
      cnt += lower_bound(ALL(B), t * 4 - A) - lower_bound(ALL(B), t * 3 - A);
    }
    ans |= (cnt & 1) << bit;
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 2672
#include <algorithm>
#include <cstdio>
const int N=100005;
int f[N],a[N],fst[N],nxt[N];
void addedge(int x,int y){
	nxt[y]=fst[x];fst[x]=y;
}
void dfs(int x){
	for (int i=fst[x];i;i=nxt[i]) dfs(i);
	int t=0;
	for (int i=fst[x];i;i=nxt[i]) a[t++]=f[i];
	std::sort(a,a+t);
	for (int i=0;i<t;i++)
		f[x]=std::max(f[x],a[i]+t-i);
}
int main(){
	int n;
	scanf("%d\n",&n);
	for (int i=2;i<=n;i++){
		int x;
		scanf("%d",&x);
		addedge(x,i);
	}
	dfs(1);
	printf("%d\n",f[1]);
}

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

#define int long long
#define pb push_back
#define mp make_pair
#define endl "\n"
#define ss second
#define ff first

#ifndef ONLINE_JUDGE
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){cerr << name << " : " << arg1 << endl;}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << "  ";
	__f(comma + 1, args...);}
#else
#define debug(...)
#endif

const int inf = 2e18;
const int ninf = -2e18;

signed main() {

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
 
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
		freopen("error.txt", "w", stderr);
	#endif

	string s, t;
	cin >> s >> t;
	vector<int> v1(26);
	vector<int> v2(26);

	int n = s.size(), m = t.size();
	int mn = n;
	for (int i = 0; i <= n - m; i++) {
		int c = 0;
		for (int j = i; j < i + m; j++) {
			if (s[j] != t[j-i]) c++;
		}
		mn = min(mn, c);

	}

	cout << mn << endl;

	return 0;
}

Measured memory_bytes: 3644
using System;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var inputs = (Console.ReadLine().Split(' ')).Select(long.Parse).ToArray();
        var k = inputs[0];
        var n = inputs[1];

        var ak = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();

        var distance = ak.Max() - ak.Min();

        for (int i = 0; i < ak.Length - 1; i++)
        {
            var val = ak[i] + (k - ak[i + 1]);
            if (distance > val) distance = val;
        }

        Console.WriteLine(distance);
    }
}

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

int main(){
	long double a,b;
	cin >> a >> b;
	ll ans = a*b;
	cout << ans << endl;
}

Measured memory_bytes: 3732
N = int(input())
Ai = list(map(int,input().split()))
    
#print(Ai)
def create_list():
  MAXI = N
  
  sn = [0 for _ in range(MAXI+1)]
  judge = 0
  for i in range(1,MAXI+1):
    #print(str(i)+'+1 when '+S[i-1])
    sn[i] = sn[i-1] + Ai[i-1]
     
  return sn

def iCj(i, j):
  mot = 1
  chi = 1
  for x in range(j):
    chi *= i-x
    mot *= x+1
  comb = int(chi/mot)
  return comb


base = create_list()
#print(base)
count = 0
base.sort()
#print(base)
#for i in range(N):
#  for j in range(i+1,N+1):
#    if(base[j]-base[i] == 0):
#      count += 1
    #  print(str(j)+' - '+str(i))
    #else:
    #  print(str(j)+' = '+str(i))
#  print( base[r[i]] - base[l[i]] )#sum(rnum)-sum(lnum) )
i = 0
while(i<N+1):
  this = 1
  j = i+1
  while(j < N+1 and base[j] == base[i]):
    this += 1
    j += 1
  if(this >= 2):
    count += iCj(this,2)
  i += this
print(count)

Measured memory_bytes: 99024
package main
 
import "fmt"
 
func judge(temp int) string {
	if 30 <= temp {
		return "Yes"
	} else {
		return "No"
	}
}
 
func main() {
	var temp int 
	fmt.Scan(&temp) 
	ans := judge(temp)
	fmt.Println(ans)
}

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

using namespace std;

typedef long long ll;

#define faster ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define read freopen("in.txt","r",stdin)
#define write freopen("out.txt","w",stdout)
#define mem(x,n) memset(x,n,sizeof(x))
#define all(x) x.begin(), x.end()
#define endl "\n"

ll mod = 1e9 + 7;

int main()
{
	faster;
	
	ll n;
	cin >> n;
	vector<ll> a(n),b(n);

	for(auto &x: a) cin >> x;
	
	b[n-1] = a[n-1];

	for(int i = n-2; i >= 0; i--){
		b[i] = (b[i+1] + a[i]) % mod;
	}

	ll sum = 0;

	sum = (b[1] * a[0]) % mod;

	for(int i = 1; i < n-1; i++){
		sum = (sum + ((a[i] * b[i+1]) % mod)) % mod;
	}
	cout << sum << endl;
	
	return 0;
}


Measured memory_bytes: 6336
#include <bits/stdc++.h>
#define int long long int
#define mod(x) ((x % MOD) + MOD) % MOD
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define RFORE(i,a,b) for(int i=(b);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define RALL(c) (c).rbegin(),(c).rend()
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SZ(c) (int)((c).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define LB(c,x) (int)(lower_bound(ALL(c),x)-(c).begin())
#define UB(c,x) (int)(upper_bound(ALL(c),x)-(c).begin())
#define COUNT(c,x) (UB(c,x)-LB(c,x))
#define UNIQUE(c) SORT(c); (c).erase(unique(ALL(c)),(c).end());
#define COPY(c1,c2) copy(ALL(c1),(c2).begin())
#define EXIST(s,e) (bool)((s).find(e)!=(s).end())
#define PB push_back
#define MP make_pair
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
using namespace std;
template<typename T1, typename T2> using P = pair<T1,T2>;
template<typename T> using V = vector<T>;
struct edge { int from, to; int cost; };
bool operator< (const edge &edge1, const edge &edge2) { return edge1.cost < edge2.cost; };
const int INF = 1e18;
const int MOD = 1e9+7;

template<typename T> ostream& operator << (ostream& s, const V<T>& v) {
   s << "[";
   for (int i = 0; i < v.size(); i++) { s << v[i]; if (i < v.size() - 1) s << " "; }
   s << "]";
   return s;
}

class UnionFind
{
   private:
      vector<int> par, myrank;
   public:
      UnionFind(int n) {
         par.resize(n);
         myrank.resize(n, 0);
         for (int i = 0; i < n; i++) {
            par[i] = i;
         }
      }
      int find(int x) {
         if (par[x] == x) return x;
         return par[x] = find(par[x]);
      }
      void unite(int x, int y) {
         x = find(x);
         y = find(y);
         if (x == y) return;
         if (myrank[x] < myrank[y]) {
            par[x] = y;
         } else {
            par[y] = x;
            if(myrank[x] == myrank[y]) myrank[x]++;
         }
      }
      bool same(int x, int y)
      {
         return find(x) == find(y);
      }
};

signed main()
{
   int N, M; cin >> N >> M;
   V<int> p(N);
   REP(i, N) {
      cin >> p[i];
      p[i]--;
   }
   V<int> x(M), y(M);
   REP(i, M) {
      cin >> x[i] >> y[i];
      x[i]--; y[i]--;
   }

   UnionFind uni(N);
   REP(i, M) {
      uni.unite(x[i], y[i]);
   }

   int ans = 0;
   REP(i, N) {
      if (uni.same(i, p[i])) {
         ans++;
      }
   }
   cout << ans << endl;

   return 0;
}


Measured memory_bytes: 4224
n, m = [int(i) for i in input().split()]
K = []
S = []
for mi in range(m):
    k, *s = [int(i) for i in input().split()]
    K.append(k)
    S.append(s)
P = [int(i) for i in input().split()]

ans = 0
for ni in range(2**n):
    bin_ni = format(ni, "010b")
    ok_flag = True
    for mi in range(m):
        sum_on = 0
        for ki in range(K[mi]):
            sum_on += int(bin_ni[-S[mi][ki]])
        if sum_on%2 != P[mi]:
            ok_flag = False
            break
    if ok_flag:
        ans += 1
print(ans)


Measured memory_bytes: 3064
a = int(input())
if 400<= a <= 599:
    print("8")
elif 600 <= a <= 799:
    print("7")
elif 800 <= a <= 999:
    print("6")
elif 1000 <= a <= 1199:
    print("5")
elif 1200 <= a <= 1399:
    print("4")
elif 1400 <= a <= 1599:
    print("3")
elif 1600 <= a <= 1799:
    print("2")
else:
    print("1")

Measured memory_bytes: 9180
#include<stdio.h>
#include<math.h>

int main(void){
  long long n, k;
  long long ans=0;

  scanf("%lld %lld", &n, &k);

  for(long long i=k;i<=n+1;i++){
    ans += i*n-(i*(i-1)-1);
    ans = ans % (long long)(pow(10,9)+7);
  }

  printf("%lld\n", ans);
  return 0;
}


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

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			Scanner cin = new Scanner();
			string s = cin.Next();
			var ss = s.ToList();
			var sss = ss.OrderBy(x => x).ToArray();
			if (sss[0] == sss[1] && sss[2] == sss[3] && sss[1] != sss[2]) {
				Console.WriteLine("Yes");
			} else {
				Console.WriteLine("No");
			}
		}
	}

	public class Scanner
	{
		string[] s;
		int i;

		char[] cs = new char[] { ' ' };

		public Scanner()
		{
			s = new string[0];
			i = 0;
		}

		public string Next()
		{
			if (i < s.Length) return s[i++];
			string st = Console.ReadLine();
			while (st == "") st = Console.ReadLine();
			s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
			if (s.Length == 0) return Next();
			i = 0;
			return s[i++];
		}

		public int Int()
		{
			return int.Parse(Next());
		}
		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Int() + add;
			}
			return Array;
		}

		public long Long()
		{
			return long.Parse(Next());
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Long() + add;
			}
			return Array;
		}

		public double Double()
		{
			return double.Parse(Next());
		}


		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Double() + add;
			}
			return Array;
		}
	}
}


Measured memory_bytes: 13396
#include <stdio.h>
int main(){
    long long int W;
    long long int H;
    long long int x;
    long long int y;
    scanf("%lld",&W);
    scanf("%lld",&H);
    scanf("%lld",&x);
    scanf("%lld",&y);
    double M;
    int b;
    b=0;
    M=(double)(W*H)/2;
    if(2*x==W&&2*y==H){
        b=1;
    }
    printf("%.10f %d",M,b);
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <numeric>
#include <iomanip>
#include <stack>
#include <complex>
#include <functional>
#include <tuple>

using namespace std;

#define Rep(i,a,b) for(ll i = a; i < b; ++i)
#define rep(i,b) Rep(i,0,b)
#define allof(a) (a).begin(), (a).end()

#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")

using ll = long long;

constexpr int inf = 1e9 + 7;
constexpr ll infll = 1ll << 60ll;
constexpr ll mod = 998244353;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

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

    void Cout(long long x, const char* end = "\n") { std::cout << x << end; }
    template <typename T> void Cout(const T& x, const char* end = "\n") { std::cout << x << end; }
    template <typename T> void Cout(const std::vector<T>& x, const char* sep = " ", const char* end = "\n") { for (std::size_t i = 0, sz = x.size(); i < sz; ++i) { std::cout << x[i] << (i == sz - 1 ? end : sep); } }

    // 標準入出力
    struct inp {
        std::size_t szi, szj;
        inp(std::size_t _szi = 1, std::size_t _szj = 1) : szi(_szi), szj(_szj) {}
        template <typename T> operator T () const { T a; std::cin >> a; return a; }
        template <typename T> operator std::vector<T>() const { std::vector<T> a(szi); for (std::size_t i = 0; i < szi; ++i) std::cin >> a[i]; return a; }
        template <typename T> operator std::vector<std::vector<T>>() const {
            std::vector<std::vector<T>> a(szi, std::vector<T>(szj));
            for (std::size_t i = 0; i < szi; ++i) for (std::size_t j = 0; j < szj; ++j) cin >> a[i][j]; return a;
        }
    };
    inp inp1;
}

int main() {

    int n, a;
    cin >> n >> a;
    vector<int> x = inp(n);
    const int kMax = 50 * n + 10;
    rep(i, n) x[i] -= a;

    // dp[i][j] := i番目までみて，総和がjとなる場合の数
    vector<vector<ll>> dp(n + 1, vector<ll>(kMax * 2, 0LL));
    dp[0][kMax] = 1LL;

    rep(i, n) {
        rep(j, kMax * 2) {
            if (j + x[i] < 0 || j + x[i] >= kMax * 2) continue;
            dp[i + 1][j + x[i]] += dp[i][j];
            dp[i + 1][j] += dp[i][j];
        }
    }

    // O(n^2 Xmax)
    Cout(dp[n][kMax] - 1LL);

    return 0;
}


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

int main() {
    int N;
    cin>>N;
    double n=N, m=(n+1)/(2*n);

    if(N%2==0) cout<<0.5000000000<<endl;
    else if(N==1) cout<<1.0000000000<<endl;
    else if(N%2!=0&&N!=1) cout<<m<<endl;

}


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

int main(int argc, char* argv[]){
	int n;
	string s;
	cin >> n >> s;
	bool ans = true;
	if(n%2 != 0) ans = false;
	else {
		string s1,s2;
		s1 = s.substr(0,n/2);
		s2 = s.substr(n/2,n/2);
		if (s1 != s2) ans = false;
	}
	cout << ( ans ? "Yes" : "No" ) << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in Actual solution is at the top
 */

public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Task solver = new Task();
		solver.solve(1, in, out);
		out.close();
	}

	static class Task {
		public void solve(int testNumber, InputReader in, PrintWriter out) {
			int X = in.nextInt();
			int Y = in.nextInt();
			int Z = in.nextInt();
			int ans = 0;
			if(X >= Y + 2 * Z) {
				X -= Z;
				ans = X / (Y + Z);
			}
			out.println(ans);
		}
	}
	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());
		}
	}
}


Measured memory_bytes: 23380
import sys

class stacker():
    def __init__(self, max):
        self.top = 0
        self.max = max
        self.vlist = list(range(max))
        
    def push(self, x):
        self.top += 1
        self.vlist[self.top] = x
        
    def pop(self):
        self.top -= 1
        return self.vlist[self.top+1]
        
    def isFull(self):
        return self.top == self.max
    
    def isEmpty(self):
        return  self.top == 0
    
def main():

    expr = list(input().split())
    stack = stacker(200)
    for i in expr:
        if i == '+':
            a = stack.pop()
            b = stack.pop()
            stack.push(a+b)
        elif i == '-':
            a = stack.pop()
            b = stack.pop()
            stack.push(b-a)
        elif i == '*':
            a = stack.pop()
            b = stack.pop()
            stack.push(a*b)
        else:
            stack.push(int(i))

    print(stack.vlist[stack.top])
    
            
if __name__ == '__main__':
    main()


Measured memory_bytes: 5608
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define sz(a) ((int)a.size())
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijoMOD(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll yakusu_num(ll n){
  vl yakusu(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      yakusu[i]++;
    }
  }
  if(n!=1)yakusu[n]++;
  ll num=1;
  for(ll i=0;i<=n;i++){
    num*=yakusu[i];
  }
  return num;
}

int H,W;
vs s(50);
vi dv ={-1,0,1,0};vi du={0,-1,0,1};
int cnt=1;
int dfs(int u,int v){
  s[u][v]='.';
  
  rep(i,4){
   
      int nu =u +du[i],nv=v+dv[i];
      if(nu<0||nu>=H||nv<0||nv>=W)continue;
      if(s[nu][nv]=='.')continue;
      cnt ++;
      dfs(nu,nv);
    
  }
  return cnt;

}
int keta_wa(int x){
  int tot=0;
  while(x>0){
    tot +=x%10;
    x/=10;
  }
  return tot;
}

//vc alp ={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
//vc Alp ={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
//cout<<""<<endl;
int main(){
  double R;cin>>R;
  double pip =3.1415926535;
  cout<<(double)2*R*pip<<endl;
}





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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x
#define ll long long
static const ll MAX = 1000000;
static const ll INFTY = 1e12;

struct edge {
    ll to, cost;
};

using Graph = vector<vector<int>>;
using _Graph = vector<vector<edge>>;
// 入力
int H, W;
vector<vector<char>> field;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

// 深さ優先探索
vector<bool> seen;
vector<int> colors;


int main() {

    int A, H;
    cin >> H >> A;
    int ans = 0;

    while(H>0){
        H -= A;
        ans++;
    }

    cout << ans << endl;    
    
}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/


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

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"

// イテレータ要素のインデックス
distance(A.begin(), itr);
*/

const int MAX_N = 100050;

int n, m;
vector<int> to[MAX_N];

ll dp[MAX_N];

void init(){
    rep(i,MAX_N){
        dp[i] = -1;
    }
}

ll f(int x, int p){
    if(dp[x]>=0) return dp[x];

    ll res = 0;
    for(int y: to[x]){
        if(y == p) continue;
        res = max(res, f(y,x) + 1);
    }
    return dp[x] = res;
}

int main()
{
    cin >> n >> m;
    rep(i,m){
        int xi, yi; cin >> xi >> yi;
        --xi, --yi;
        to[xi].push_back(yi);
    }

    init();

    ll ans = 0;
    rep(i,n){
        ans = max(ans, f(i,-1));
    }

    cout << ans << endl;

}

Measured memory_bytes: 12608
#include <bits/stdc++.h>
using namespace std;
const int MAXN=200010;
int N,K;double A[MAXN];
int main()
{
	cin>>N>>K;
	for (int i=1;i<=N;++i) scanf("%lf",&A[i]),A[i]=(1+A[i])/2;
	for (int i=1;i<=N;++i) A[i]+=A[i-1];
	double Ans=0;
	for (int i=1;i+K-1<=N;++i)
	{
		Ans=max(Ans,A[i+K-1]-A[i-1]);
	}
	printf("%.12lf\n",Ans);
	return 0;
}

Measured memory_bytes: 1792
/// kazuki08
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define ar array
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());



signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
  
  int n,m;
  cin >> n >> m;
  int sum = 0;
  for(int i=0;i<m;i++){
    int x;
    cin >> x;
    sum+=x;
  }
  if(sum>n){
    cout << -1 << endl;
  }
  else {
    cout << (n-sum) << endl;
  }

return 0;
}
///....


Measured memory_bytes: 3660
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <set>

using namespace std;

typedef long long i64;
typedef i64 int_t;
typedef vector<int_t> vi;
typedef vector<vi> vvi;

typedef pair<int_t, int_t> pi;

#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)
#define pb push_back
#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()
#define REP(s, e, i) for(i=(s); i < (e); ++i)

int main(int argc, char *argv[]) {
  i64 N, i;
  cin >> N;
  vi A(N);
  vi I(N+1);
  i64 L = 0;
  I[0] = 0;
  REP(0, N, i) {
    cin >> A[i];
    L += A[i];
    I[i+1] = I[i] + A[i];
  }

  i64 D1 = L / 2, D2 = (L+1) / 2;
  auto p1 = upper_bound(all(I), D1);
  auto p2 = lower_bound(all(I), D2);
  p1--;

  cout << min(L - 2 * *p1, 2 * *p2 - L) << endl;

  return 0;
}


Measured memory_bytes: 3456
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
const int inf=0x3f3f3f3f;
#define pi 3.141592653589732
int main (){
	double a,b,x,y;
	cin>>a>>b>>x>>y;
	double aa=abs(30*x-5.5*y);
	double bb=aa*pi/180;
	bb=cos(bb);
	bb=bb*2*a*b;
	double cc=a*a+b*b-bb;
	printf("%.10lf",sqrt(cc));
	return 0;
}

Measured memory_bytes: 4216
from collections import Counter
n,k=map(int,input().split())
R,S,P=map(int,input().split())
s=input()
c=Counter(s)
ans=c["r"]*P+c["s"]*R+c["p"]*S
for _ in range(k):
  i=0
  while (_+(i+1)*k)<n:
    if s[_+i*k]==s[_+(i+1)*k]:
      if s[_+(i+1)*k]=="r":
        ans-=P
        i+=1
      elif s[_+(i+1)*k]=="s":
        ans-=R
        i+=1
      elif s[_+(i+1)*k]=="p":
        ans-=S
        i+=1
    i+=1     
print(ans)   

Measured memory_bytes: 3572
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main() {
    ll s;
    std::cin >> s;
    ll ans = (s+(ll)1e9-1)/(ll)1e9;
    std::cout << "0 0 "<<ans<<" "<<ans*(ll)1e9-s<<" "<<1<<" "<<(ll)1e9<< std::endl;
}


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

#define fst first
#define snd second
#define mp make_pair
#define rep(i,a,n) for(int i=(a);i<(n);++i)
#define per(i,a,n) for(int i=(n)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

template <typename T1, typename T2>
inline bool umin(T1& x, const T2& y){return x>y ? x=y,true : false;}

template <typename T1, typename T2>
inline bool umax(T1& x, const T2& y){return x<y ? x=y,true : false;}

typedef long long ll;
typedef long double ld;

const int N    = (int)1e6+7;
const int mod  = (int)1e9+7;
const int INF  = (int)1e9+17;
const ll LLINF = (ll)1e18+17;



int n, k;
int h[N];
ll dp[N];

const ld infinity = numeric_limits<ld>::infinity();

struct Point {
    ld x, y;
    Point() = default;
    Point(ld x, ld y):
        x(x), y(y) {}
};

struct Line {
    ll k, b;
    Line() = default;
    Line(ll k, ll b):
        k(k), b(b) {}
    ll getval(ll x) const { return k * x + b; }
    static Point intersect(const Line& p, const Line& q) {
        if (p.k == q.k && p.b == q.b) return Point(-infinity, -infinity);
        if (p.k == q.k) return Point(-infinity, -infinity);
        ld x = ((ld)(q.b - p.b)) / (p.k - q.k);
        ld y = p.k * x + p.b;
        return Point(x, y);
    }
};

class ConvexHull {
public:
    ConvexHull() {}
    void addLine(const Line& ln) {
        while (!points.empty() && Line::intersect(ln, line.back()).x <= points.back().x) {
            line.pop_back();
            points.pop_back();
        }
        if (!line.empty()) {
            points.push_back(Line::intersect(ln, line.back()));
        }
        line.push_back(ln);
    }
    ll getmin(ll p) {
        int idx = lower_bound(all(points), Point(p, -infinity),
            [](const Point& a, const Point& b) {
                return a.x < b.x;
        }) - points.begin();;
        return line[idx].getval(p);
    }
private:
    vector<Line> line;
    vector<Point> points;
};

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
    #define FILENAME ""
//    freopen(FILENAME".in", "r", stdin);
//    freopen(FILENAME".out", "w", stdout);
#endif

    ll C;
    cin >> n >> C;
    rep(i, 0, n) cin >> h[i];
    fill(dp, dp+n, LLINF);
    dp[0] = 0;
    ConvexHull cht;
    rep(i, 0, n) {
        if (i > 0) {
            dp[i] = 1ll * h[i] * h[i] + cht.getmin(h[i]) + C;
        }
        cht.addLine(Line(-2 * h[i], 1ll * h[i] * h[i] + dp[i]));
    }
    cout << dp[n-1] << endl;


    return 0;
}


Measured memory_bytes: 20316
#include <iostream>
using namespace std;
int main(){
	int n,c=0;
	scanf("%d",&n);
	if(n>=105)c++;
	if(n>=135)c++;
	if(n>=165)c++;
	if(n>=189)c++;
	if(n>=195)c++;
	printf("%d",c);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    
    int n;
    cin >> n;
    
    int taroScore=0;
    int hanakoScore=0;
    
    for(int i=0;i<n;i++){
        string taro;
        string hanako;
        cin >> taro;
        cin >> hanako;
        
        if(taro>hanako){
            taroScore+=3;
        }else if(taro<hanako){
            hanakoScore+=3;
        }else{
            taroScore+=1;
            hanakoScore+=1;
        }
    }
    
    cout << taroScore << " " << hanakoScore << endl;

    
}

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

#define pb push_back
#define x first
#define y second

using namespace std;

int n, k;
vector<int> a[2003];
int cur;
int vis[2003];
pair<int, int> e[2003];

signed main() {
	scanf("%d%d", &n, &k);
	bool ok = k % 2;
	for (int i = 1; i <= n-1; i++) {
		int x, y;
		scanf("%d%d", &x, &y);
		a[x].pb(y);
		a[y].pb(x);
		e[i] = {x, y};
	}
	k /= 2;
	int res = INT_MAX;
	if (ok == 0) {
		for (int i = 1; i <= n; i++) {
			cur = 0;
			memset(vis, 0, sizeof vis);
			queue< pair<int, int> > q;
			q.push({i, 0});
			vis[i] = 1;
			while (q.empty() == false) {
				int val = q.front().y;
				int u = q.front().x;
				q.pop();
				if (val > k) cur++;
				for (auto v : a[u]) {
					if (!vis[v]) {
						q.push({v, val+1});
						vis[v] = 1;
					}
				}
			}		
			res = min(res, cur);
		}
	}
	else {
		for (int i = 1; i <= n-1; i++) {
			cur = 0;
			memset(vis, 0, sizeof vis);
			queue< pair<int, int> > q;
			q.push({e[i].x, 0});
			q.push({e[i].y, 0});
			vis[e[i].x] = 1; vis[e[i].y] = 1;
			while (q.empty() == false) {
				int val = q.front().y;
				int u = q.front().x;
				q.pop();
				if (val > k) cur++;
				for (auto v : a[u]) {
					if (!vis[v]) {
						q.push({v, val+1});
						vis[v] = 1;
					}
				}
			}	
			res = min(res, cur);
		}
	}
	cout << res;
}

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

int main() {
    long long l,r,x,a,b,f;
    cin>>l>>r>>x;
    a=l/x;
    b=r/x;
    f=b-a;
    if(l%x==0) f++;
    cout<<f<<"\n";
}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <algorithm>

int n;
bool board[100000];

std::vector<int> v;

int main() {
	std::cin>>n;
	for(int i=0;i<n;++i)
		std::cin>>board[i];
	for(int i=0;i<n-1;++i) {
		if(board[i]==board[i+1])
			v.push_back(i);
	}
	v.push_back(n-1);

	if(v.size()==1||v.size()==2){
		std::cout<<n<<std::endl;
		return 0;
	}

	int ans=v[2]+1;

	for(int i=1;i<v.size()-2;++i)
		ans=std::max(ans,v[i+2]-v[i-1]);

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

	return 0;
}

Measured memory_bytes: 3308
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	int a[2020]={0};
	cin>>s;
	int ans = 0;
	int t = 1;
	int cnt = 0;
	a[0]++;
	for(int i=s.length()-1;~i;i--){
		cnt = (cnt+t*(s[i]-'0'))%2019;
		ans+=(a[cnt]++);
		t=(t*10)%2019;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3760
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#include<random>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

ll gcd(ll n, ll m) {
	ll tmp;
	while (m!=0) {
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m) {
	return abs(n * m) / gcd(n, m);//gl=xy
}
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
using namespace std;

void solve(){
  ll h,w;
  cin>>h>>w;
  if((h*w)%3==0)cout<<0<<endl;
  else {
    ll ans=1e12;
    for(ll i=1;i<=h-1;++i){
      for(ll j=max(1LL,w/2-5);j<=min(w-1,w/2+5);++j){
        ll s=w*i;
        ll a=(h-i)*j;
        ll b=h*w-s-a;
        chmin(ans,max({s,a,b})-min({s,a,b}));
      }
    }
    for(ll i=1;i<=w-1;++i){
      for(ll j=max(1LL,h/2-5);j<=min(h-1,h/2+5);++j){
        ll s=h*i;
        ll a=(w-i)*j;
        ll b=h*w-s-a;
        chmin(ans,max({s,a,b})-min({s,a,b}));
      }
    }
    for(ll i=max(1LL,h/3-5);i<=min(h-2,h/3+5);++i){
      for(ll j=max(i+1,(2*h)/3-5);j<=min(h-1,(2*h)/3);++j){
        ll s=w*i;
        ll a=w*j-s;
        ll b=h*w-s-a;
        chmin(ans,max({s,a,b})-min({s,a,b}));
      }
    }
    for(ll i=max(1LL,w/3-5);i<=min(w-2,w/3+5);++i){
      for(ll j=max(i+1,(2*w)/3-5);j<=min(w-1,(2*w)/3);++j){
        ll s=h*i;
        ll a=h*j-s;
        ll b=h*w-s-a;
        chmin(ans,max({s,a,b})-min({s,a,b}));
      }
    }
    cout<<ans<<endl;
  }
}

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


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

int main() {
  string S;
  cin >> S;
  
  int ans = 0;
  
  for (int i = 0, j = 0; i < S.size(); i = i + j, j = 0) {
    if (S.at(i) == 'R') {
      int r_days = 0;
      while (i + j < S.size() && S.at(i + j) == 'R') {
        r_days++;
        j++;
      }
      ans = max(ans, r_days);
    } else {
      i++;
    }
  }
  
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 3576
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    char a[100],b[]="YAKI";
    while(cin>>a)
    {
        int i,flag=1;
        for(i=0;a[i]!=0&&i<=3;i++)
        if(a[i]!=b[i])
        {
            flag=0;
            break;
        }
        if(flag==1&&i==4)
            cout<<"Yes\n";
        else
            cout<<"No\n";
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <queue>
#include <list>
#define rep(i,n) for(int i=0;i<(n);i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define All(x) (x).begin(),(x).end()
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8

ll A[57];

int main() {
    ll A,B,C,D=0;
    cin >> A >> B >> C;
    rep(i,1000){
        D+=A;
        if(D%B==C){
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define pb push_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define chmin(x,y) if(x>y)x=y
#define chmax(x,y) if(x<y)x=y
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll,vector<ll>,greater<ll>> SPQ;
using vi=vector<ll>;
using vvi=vector<vector<ll>>;
using vc=vector<char>;
using vvc=vector<vector<char>>;
const ll inf=1001001001001001;
const int Inf=1001001001;
const int mod=1000000007;
int main(){
    ll n,ans=0;cin>>n;
    vi v(n);
    rep(i,n){
        int a;cin>>a;
        v[i]=a-i-1;
    }
    sort(all(v));
    rep(i,n){
        ans+=abs(v[n/2]-v[i]);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    string st;
    cin>>n;
    cin>>st;
    int ans=0;
    int now=0;
    for(int i=0;i<n;i++){
        if(st[i]=='I'){
            now++;
        }else{
            now--;
        }
        ans=max(ans,now);
    }
    cout<<ans<<endl;
    return 0;
}

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

int main(void) {
    int h1,m1,h2,m2,k;
    scanf("%d %d %d %d %d",&h1,&m1,&h2,&m2,&k);
    int ret=(h2-h1)*60+m2-m1;
    printf("%d",max(ret-k,0));
}

Measured memory_bytes: 3812